Browse Source

Add decimal management for product's quantity

SiM 5 years ago
parent
commit
8e6a0510fb
41 changed files with 376 additions and 229 deletions
  1. 2 4
      apps/admin/modules/kataoInvoice/templates/deliverSuccess.php
  2. 11 7
      apps/admin/modules/kataoOrder/templates/adjustProductSuccess.php
  3. 2 3
      apps/admin/modules/kataoOrder/templates/deliverProductSuccess.php
  4. 1 3
      apps/admin/modules/kataoOrder/templates/receiveSuccess.php
  5. 8 1
      apps/admin/modules/kataoProduct/templates/editSuccess.php
  6. 4 0
      apps/admin/modules/kataoProduct/templates/showSuccess.php
  7. 8 2
      apps/frontend/modules/katao/actions/actions.class.php
  8. 7 5
      apps/frontend/modules/katao/templates/_products.php
  9. 7 1
      apps/frontend/modules/katao/templates/cartSuccess.php
  10. 5 3
      apps/frontend/modules/katao/templates/storeSuccess.php
  11. 10 9
      config/schema.yml
  12. 10 9
      data/sql/lib.model.schema.sql
  13. 19 0
      data/sql/patch_2018-11-14_gestion-decimales.sql
  14. 6 0
      lib/form/KataoProductForm.class.php
  15. 6 6
      lib/form/base/BaseKataoCartProductForm.class.php
  16. 4 4
      lib/form/base/BaseKataoInvoiceProductForm.class.php
  17. 6 6
      lib/form/base/BaseKataoOrderProductForm.class.php
  18. 2 0
      lib/form/base/BaseKataoProductForm.class.php
  19. 2 2
      lib/form/base/BaseKataoSupplierInvoiceProductForm.class.php
  20. 2 2
      lib/model/KataoCartProductPeer.php
  21. 3 3
      lib/model/KataoOrder.php
  22. 1 1
      lib/model/KataoOrderProduct.php
  23. 1 1
      lib/model/KataoOrderProductPeer.php
  24. 11 6
      lib/model/KataoProduct.php
  25. 1 1
      lib/model/KataoUser.php
  26. 3 3
      lib/model/map/KataoCartProductMapBuilder.php
  27. 2 2
      lib/model/map/KataoInvoiceProductMapBuilder.php
  28. 3 3
      lib/model/map/KataoOrderProductMapBuilder.php
  29. 2 0
      lib/model/map/KataoProductMapBuilder.php
  30. 1 1
      lib/model/map/KataoSupplierInvoiceProductMapBuilder.php
  31. 12 30
      lib/model/om/BaseKataoCartProduct.php
  32. 8 20
      lib/model/om/BaseKataoInvoiceProduct.php
  33. 12 30
      lib/model/om/BaseKataoOrderProduct.php
  34. 96 49
      lib/model/om/BaseKataoProduct.php
  35. 4 2
      lib/model/om/BaseKataoProductPeer.php
  36. 4 10
      lib/model/om/BaseKataoSupplierInvoiceProduct.php
  37. 27 0
      lib/symfony/lib/helper/FormHelper.php
  38. 49 0
      lib/symfony/lib/widget/sfWidgetFormInputNumber.class.php
  39. 14 0
      plugins/catalyz/web/js/tiny_mce/plugins/imagemanager/js/mox/dom/layer.js
  40. BIN
      web/images/decimals_icon.png
  41. BIN
      web/images/decimals_not_icon.png

+ 2 - 4
apps/admin/modules/kataoInvoice/templates/deliverSuccess.php

@@ -26,9 +26,7 @@ $criteria->addAscendingOrderByColumn(KataoInvoiceProductPeer::PRODUCT_NAME); ?>
  	<td><?php echo $katao_invoice_product->getProductName() ?></td>
  	<td style="text-align:center!important"><?php echo $katao_invoice_product->getQuantity() ?></td>
  	<td nowrap="nowrap" style="text-align:center!important">
- 		<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_invoice_product->getId() ?>').value = Math.max(0, parseInt(document.getElementById('quantity_<?php echo $katao_invoice_product->getId() ?>').value) - 1); updateCurrentDelivered(<?php echo $katao_invoice_product->getId() ?>, <?php echo $total_delivered_quantity ?>);" title="Diminuer la quantité"><?php echo image_tag('minus.png', array('alt' => 'Diminuer la quantité', 'align' => 'top')) ?></a>
-		<?php echo input_tag('quantity[' . $katao_invoice_product->getId() . ']', $quantity, array('style' => 'width: 20px; text-align: center;', 'class' => 'quantity-delivered', 'onchange' => 'updateCurrentDelivered(' . $katao_invoice_product->getId() . ', ' . $total_delivered_quantity . ');')) ?>
-		<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_invoice_product->getId() ?>').value = parseInt(document.getElementById('quantity_<?php echo $katao_invoice_product->getId() ?>').value) + 1; updateCurrentDelivered(<?php echo $katao_invoice_product->getId() ?>, <?php echo $total_delivered_quantity ?>);" title="Augmenter la quantité"><?php echo image_tag('plus.png', array('alt' => 'Augmenter la quantité', 'align' => 'top')) ?></a>
+		<?php echo input_number_tag('quantity[' . $katao_invoice_product->getId() . ']', $quantity, array('style' => 'width: 60px; height: 20px; text-align: center;', 'class' => 'quantity-delivered', 'onchange' => 'updateCurrentDelivered(' . $katao_invoice_product->getId() . ', ' . $total_delivered_quantity . ');')) ?>
 	</td>
 	<td style="text-align:center!important"><span id="current-quantity-<?php echo $katao_invoice_product->getId() ?>"><?php echo $total_delivered_quantity + $quantity ?></span> / <?php echo $katao_product->getTotalReceivedQuantity($katao_invoice->getKataoPeriodId(), $katao_invoice->getKataoNodeId()) ?></td>
 
@@ -47,7 +45,7 @@ $criteria->addAscendingOrderByColumn(KataoInvoiceProductPeer::PRODUCT_NAME); ?>
 /* <![CDATA[ */
 
 function updateCurrentDelivered(id, total_delivered_quantity){
-	$('current-quantity-' + id).innerHTML = total_delivered_quantity + parseInt($F('quantity_' + id));
+	$('current-quantity-' + id).innerHTML = total_delivered_quantity + parseFloat($F('quantity_' + id));
 }
 
 /* ]]> */

+ 11 - 7
apps/admin/modules/kataoOrder/templates/adjustProductSuccess.php

@@ -6,12 +6,20 @@
 <?php echo form_tag('@katao_order_product_adjust?id=' . $katao_order_product->getId()) ?>
 
 <?php $katao_product = $katao_order_product->getKataoProduct() ?>
+<?php $authorize_quantity_decimal = $katao_product->getAuthorizeDecimal() ?>
+<?php $input_options = array('step' => ($authorize_quantity_decimal ?'any' : '1'), 'min' => '0', 'style' => 'width: 60px; height: 20px; text-align: center;') ?>
 <h3><?php echo $katao_order_product->getProductName() ?></h3>
 
 <table class="admin-sub-list">
 <tr>
 	<td style="border:none!important">Commande : <?php echo $katao_product->getOrderDetails($katao_order_product->getKataoOrder()->getKataoPeriodId(), $katao_order_product->getKataoOrder()->getKataoNodeId(), true) ?></td>
-	<th colspan="2" style="text-align:center!important">Quantités</th>
+	<th colspan="2" style="text-align:center!important">Quantités 
+		<?php if ($authorize_quantity_decimal): ?> 
+			<?php echo image_tag('decimals_icon.png', array('alt' => 'Décimales autorisées', 'title' => 'Décimales autorisées', 'align' => 'middle' )); ?>
+		<?php else: ?>
+			<?php echo image_tag('decimals_not_icon.png', array('alt' => 'Décimales non autorisées', 'title' => 'Décimales non autorisées', 'align' => 'middle' )); ?>
+		<?php endif ?>
+	</th>
 </tr>
 <tr>
 	<th>Adhérent</th>
@@ -28,9 +36,7 @@
  	<td><?php echo $katao_cart_product->getQuantity() ?></td>
  	<td nowrap="nowrap">
  	<?php if (!$view_mode_only): ?>
- 		<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value = Math.max(0, parseInt(document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value) - 1)" title="Diminuer la quantité"><?php echo image_tag('minus.png', array('alt' => 'Diminuer la quantité', 'align' => 'top')) ?></a>
-		<?php echo input_tag('quantity[' . $katao_cart_product->getId() . ']', $katao_cart_product->getQuantityAdjusted(), array('style' => 'width: 20px; text-align: center;')) ?>
-		<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value = parseInt(document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value) + 1" title="Augmenter la quantité"><?php echo image_tag('plus.png', array('alt' => 'Augmenter la quantité', 'align' => 'top')) ?></a>
+		<?php echo input_number_tag('quantity[' . $katao_cart_product->getId() . ']', $katao_cart_product->getQuantityAdjusted(), $input_options) ?>
 	<?php else: ?>
 		<?php echo $katao_cart_product->getQuantityAdjusted() ?>
 	<?php endif ?>
@@ -42,9 +48,7 @@
  	<td><?php echo select_tag('new_user_id', options_for_select($katao_order_product->getMembersWithoutProduct(), false, array('include_custom' => '&mdash;&nbsp;Ajouter une commande à un adhérent&nbsp;&mdash;'))) ?></td>
  	<td>-</td>
  	<td nowrap="nowrap">
- 		<a href="javascript://" onclick="document.getElementById('quantity_0').value = Math.max(0, parseInt(document.getElementById('quantity_0').value) - 1)" title="Diminuer la quantité"><?php echo image_tag('minus.png', array('alt' => 'Diminuer la quantité', 'align' => 'top')) ?></a>
-		<?php echo input_tag('quantity[0]', '0', array('style' => 'width: 20px; text-align: center;')) ?>
-		<a href="javascript://" onclick="document.getElementById('quantity_0').value = parseInt(document.getElementById('quantity_0').value) + 1" title="Augmenter la quantité"><?php echo image_tag('plus.png', array('alt' => 'Augmenter la quantité', 'align' => 'top')) ?></a>
+		<?php echo input_number_tag('quantity[0]', '0', $input_options) ?>
 	</td>
 </tr>
 <?php endif ?>

+ 2 - 3
apps/admin/modules/kataoOrder/templates/deliverProductSuccess.php

@@ -28,9 +28,8 @@
  	<td style="text-align:center!important"><?php echo $katao_cart_product->getQuantity() ?></td>
  	<td style="text-align:center!important"><?php echo $katao_cart_product->getQuantityAdjusted() ?></td>
  	<td nowrap="nowrap" style="text-align:center!important">
- 		<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value = Math.max(0, parseInt(document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value) - 1); updateTotalDelivered();" title="Diminuer la quantité"><?php echo image_tag('minus.png', array('alt' => 'Diminuer la quantité', 'align' => 'top')) ?></a>
-		<?php echo input_tag('quantity[' . $katao_cart_product->getId() . ']', $quantity, array('style' => 'width: 20px; text-align: center;', 'class' => 'quantity-delivered', 'onchange' => 'updateTotalDelivered();')) ?>
-		<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value = parseInt(document.getElementById('quantity_<?php echo $katao_cart_product->getId() ?>').value) + 1; updateTotalDelivered();" title="Augmenter la quantité"><?php echo image_tag('plus.png', array('alt' => 'Augmenter la quantité', 'align' => 'top')) ?></a>
+		<?php echo input_number_tag('quantity[' . $katao_cart_product->getId() . ']', $quantity, array('style' => 'width: 60px; height: 20px; text-align: center;', 'class' => 'quantity-delivered', 'onchange' => 'updateTotalDelivered();')) ?>
+
 	</td>
 </tr>
 <?php endforeach ?>

+ 1 - 3
apps/admin/modules/kataoOrder/templates/receiveSuccess.php

@@ -19,9 +19,7 @@
  	<td><?php echo $katao_order_product->getProductName() ?></td>
  	<td style="text-align:center!important"><?php echo $katao_order_product->getQuantity() ?></td>
  	<td nowrap="nowrap" style="text-align:center!important">
- 		<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_order_product->getId() ?>').value = Math.max(0, parseInt(document.getElementById('quantity_<?php echo $katao_order_product->getId() ?>').value) - 1)" title="Diminuer la quantité"><?php echo image_tag('minus.png', array('alt' => 'Diminuer la quantité', 'align' => 'top')) ?></a>
-		<?php echo input_tag('quantity[' . $katao_order_product->getId() . ']', $katao_order_product->getHasBeenReceived()?$katao_order_product->getQuantityReceived():$katao_order_product->getQuantity(), array('style' => 'width: 20px; text-align: center;')) ?>
-		<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_order_product->getId() ?>').value = parseInt(document.getElementById('quantity_<?php echo $katao_order_product->getId() ?>').value) + 1" title="Augmenter la quantité"><?php echo image_tag('plus.png', array('alt' => 'Augmenter la quantité', 'align' => 'top')) ?></a>
+		<?php echo input_number_tag('quantity[' . $katao_order_product->getId() . ']', $katao_order_product->getHasBeenReceived()?$katao_order_product->getQuantityReceived():$katao_order_product->getQuantity(), array('style' => 'width: 60px; height: 20px; text-align: center;')) ?>
 	</td>
 </tr>
 <?php endforeach ?>

+ 8 - 1
apps/admin/modules/kataoProduct/templates/editSuccess.php

@@ -64,6 +64,13 @@
 		  <?php echo $form['min_order_number']->renderError() ?>
         </td>
       </tr>
+      <tr valign="top">
+        <th align="left"><?php echo $form['authorize_decimal']->renderLabel() ?></th>
+        <td>
+          <?php echo $form['authorize_decimal'] ?>
+      <?php echo $form['authorize_decimal']->renderError() ?>
+        </td>
+      </tr>
       <tr valign="top">
         <th align="left"><?php echo $form['delivery_delay']->renderLabel() ?></th>
         <td>
@@ -235,4 +242,4 @@ computeSolPercent();
 <?php endif ?>
 
 /* ]]> */
-</script>
+</script>

+ 4 - 0
apps/admin/modules/kataoProduct/templates/showSuccess.php

@@ -48,6 +48,10 @@
       <th>Min order number:</th>
       <td><?php echo $katao_product->getMinOrderNumber() ?></td>
     </tr>
+    <tr valign="top">
+      <th>Authorize quantity with decimal:</th>
+      <td><?php echo $katao_product->getAuthorizeDecimal() ?></td>
+    </tr>
     <tr valign="top">
       <th>Margin:</th>
       <td><?php echo $katao_product->getMargin() ?></td>

+ 8 - 2
apps/frontend/modules/katao/actions/actions.class.php

@@ -128,8 +128,14 @@ class kataoActions extends sfActions {
         $this->forward404Unless($katao_product);
         $this->forward404If(!$katao_product->isCartable());
 
-        if (0 < (int)$request->getParameter('quantity')) {
-            $this->getUser()->getInstance()->addProductToCart($katao_product->getId(), $request->getParameter('quantity', 1));
+        $quantity = $request->getParameter('quantity', 1);
+        if (0 < (float)$quantity) {
+            if ($katao_product->getAuthorizeDecimal()) {
+                $quantity = number_format($quantity, 3);
+            } else {
+                $quantity = round($quantity);
+            }
+            $this->getUser()->getInstance()->addProductToCart($katao_product->getId(), $quantity);
         } else {
             $this->getUser()->getInstance()->removeProductFromCart($katao_product->getId());
         }

+ 7 - 5
apps/frontend/modules/katao/templates/_products.php

@@ -2,14 +2,15 @@
 	<ul class="plus">
 	<?php $products_displayed = 0 ?>
 	<?php foreach($pager->getResults() as/*(KataoProduct)*/ $katao_product): ?>
+		<?php $authorize_quantity_decimal = $katao_product->getAuthorizeDecimal() ?>
 		<?php $is_cartable = $katao_product->isCartable() && $sf_user->isAuthenticated() && $sf_user->hasCredential('member') ?>
 		<?php $order_details = $is_cartable?$katao_product->getOrderDetails($sf_user->getActivePeriod()->getId(), $sf_user->getActiveNode()->getId()):'' ?>
 		<?php
 
     $display = false;
 if (!$url) {
-    if (preg_match('/(?P<colis>\\d+) \\((?P<incomplet>\\d+) \/ (?P<minimum>\\d+)\\)/', $order_details, $matches)) {
-        if (!empty($matches['incomplet']) && (int)$matches['incomplet'] != (int)$matches['minimum']) {
+    if (preg_match('/(?P<colis>\\d+) \\((?P<incomplet>\d+\.?\d*) \/ (?P<minimum>\\d+)\\)/', $order_details, $matches)) {
+        if ($matches['incomplet']>0 && (float)$matches['incomplet'] != (float)$matches['minimum']) {
             $display = true;
         }
     }
@@ -40,11 +41,12 @@ if ($display) {
 			<?php if ($is_cartable): ?>
 				<div style="clear: both; padding-top: 15px">
 					<div style="float: left; padding-right: 10px">
-						<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_product->getId() ?>').value = Math.max(1, parseInt(document.getElementById('quantity_<?php echo $katao_product->getId() ?>').value) - 1)" title="Diminuer la quantité"><?php echo image_tag('minus.png', array('alt' => 'Diminuer la quantité', 'align' => 'top')) ?></a>
-						<input type="text" name="quantity[<?php echo $katao_product->getId() ?>]" id="quantity_<?php echo $katao_product->getId() ?>" value="1" style="width: 20px; text-align: center;" />
-						<a href="javascript://" onclick="document.getElementById('quantity_<?php echo $katao_product->getId() ?>').value = parseInt(document.getElementById('quantity_<?php echo $katao_product->getId() ?>').value) + 1" title="Augmenter la quantité"><?php echo image_tag('plus.png', array('alt' => 'Augmenter la quantité', 'align' => 'top')) ?></a>
+						<input type="number" min="0" name="quantity[<?php echo $katao_product->getId() ?>]" id="quantity_<?php echo $katao_product->getId() ?>" <?php if ($authorize_quantity_decimal): ?>step="any" value="1.000"<?php else: ?>step="1" value="1"<?php endif ?> style="width: 60px; height: 20px; text-align: center;" />	
 					</div>
 					<div style="float: left">
+						<?php if ($authorize_quantity_decimal): ?>
+							<p>Décimales autorisées pour ce produit</p>
+						<?php endif ?>
 						<a class="btn-commander" href="javascript://" onclick="window.location = '<?php echo url_for('@katao_cart_add_js') ?>?product=<?php echo $katao_product->getUrlIdentifier() ?>&quantity='+document.getElementById('quantity_<?php echo $katao_product->getId() ?>').value;">Commander</a>
 					</div>
 				</div>

+ 7 - 1
apps/frontend/modules/katao/templates/cartSuccess.php

@@ -42,6 +42,7 @@ unset($allLanguages[$default]);
 	<?php foreach($cart->getKataoCartProductsJoinKataoProduct() as/*(KataoCartProduct)*/ $katao_cart_product): ?>
 		<?php $quantity = $katao_cart_product->getQuantity() ?>
 		<?php $katao_product = $katao_cart_product->getKataoProduct() ?>
+		<?php $authorize_quantity_decimal = $katao_product->getAuthorizeDecimal() ?>
 		<li>
 			<div class="image01">
 				<div class="top"></div>
@@ -60,7 +61,12 @@ unset($allLanguages[$default]);
 
 				<div style="clear: both">
 					<div style="float: left; padding-right: 10px">
-						<input type="text" name="quantity_<?php echo $katao_product->getId() ?>" id="quantity_<?php echo $katao_product->getId() ?>" value="<?php echo $quantity ?>" style="width: 20px; text-align: center;" />
+						<input type="number" min="0" name="quantity_<?php echo $katao_product->getId() ?>" id="quantity_<?php echo $katao_product->getId() ?>" value="<?php echo $quantity ?>" <?php if ($authorize_quantity_decimal): ?>step="any"<?php else: ?>step="1"<?php endif ?> style="width: 60px; height: 20px; text-align: center;" />
+						<?php if ($authorize_quantity_decimal): ?>
+							<?php echo image_tag('decimals_icon.png', array('alt' => 'Décimales autorisées', 'title' => 'Décimales autorisées', 'align' => 'top' )); ?>
+						<?php else: ?>
+							<?php echo image_tag('decimals_not_icon.png', array('alt' => 'Décimales non autorisées', 'title' => 'Décimales non autorisées', 'align' => 'top' )); ?>
+						<?php endif ?>
 					</div>
 					<div style="float: left; padding-right: 10px; padding-top: 4px">
 						<a class="btn-plus" href="javascript://" onclick="window.location = '<?php echo url_for('@katao_cart_add_js') ?>?product=<?php echo $katao_product->getUrlIdentifier() ?>&quantity='+document.getElementById('quantity_<?php echo $katao_product->getId() ?>').value;">Mettre à jour</a>

+ 5 - 3
apps/frontend/modules/katao/templates/storeSuccess.php

@@ -42,6 +42,7 @@ unset($allLanguages[$default]);
 <?php elseif ($katao_product_category && $katao_product_family && $katao_product): ?>
 	<?php $katao_product = KataoProductPeer::retrieveByUrlIdentifier($katao_product) ?>
 	<?php $katao_product_cartable = $katao_product->isCartable() ?>
+	<?php $authorize_quantity_decimal = $katao_product->getAuthorizeDecimal() ?>
 	<ul class="plus01">
 		<li>
 			<div class="image02">
@@ -74,10 +75,11 @@ unset($allLanguages[$default]);
 				<div style="clear: both; margin-top: 40px">
 				<?php if ($katao_product_cartable): ?>
 					<div style="float: left; padding-right: 10px">
-						<a href="javascript://" onclick="document.getElementById('quantity').value = Math.max(1, parseInt(document.getElementById('quantity').value) - 1)" title="Diminuer la quantité"><?php echo image_tag('minus.png', array('alt' => 'Diminuer la quantité', 'align' => 'top')) ?></a>
-						<input type="text" name="quantity" id="quantity" value="1" style="width: 20px; text-align: center;" />
-						<a href="javascript://" onclick="document.getElementById('quantity').value = parseInt(document.getElementById('quantity').value) + 1" title="Augmenter la quantité"><?php echo image_tag('plus.png', array('alt' => 'Augmenter la quantité', 'align' => 'top')) ?></a>
+						<input type="number" name="quantity" id="quantity" value="1" style="width: 60px; height: 20px; text-align: center;" />
 					</div>
+					<?php if ($authorize_quantity_decimal): ?>
+						<p>Décimales autorisées pour ce produit</p>
+					<?php endif ?>
 					<div style="float: left">
 						<a class="btn-commander" href="javascript://" onclick="window.location = '<?php echo url_for('@katao_cart_add_js') ?>?product=<?php echo $katao_product->getUrlIdentifier() ?>&quantity='+document.getElementById('quantity').value;">Commander</a>
 					</div>

+ 10 - 9
config/schema.yml

@@ -99,6 +99,7 @@ propel:
     katao_supplier_id:        { type: integer, foreignTable: katao_supplier, foreignReference: id, required: true, onDelete: cascade }
     max_sol_amount:           { type: integer }
     unit_price_euro:          { type: float, required: true }
+    authorize_decimal:        { type: boolean, size: 1, default: false }
     margin:                   { type: float }
     tva_rate:                 { type: float, default: 0 }
     min_order_number:         { type: integer, required: true, default: 1 }
@@ -218,10 +219,10 @@ propel:
     product_price_euro:     { type: float, required: true }
     product_margin:         { type: float }
     product_tva_rate:       { type: float, default: 0 }
-    quantity:               { type: integer, required: true, default: 1 }
-    quantity_adjusted:      { type: integer, default: 0 }
+    quantity:               { type: float, required: true, default: 1 }
+    quantity_adjusted:      { type: float, default: 0 }
     has_been_adjusted:      { type: integer, size: 1, default: 0 }
-    quantity_delivered:     { type: integer, default: 0 }
+    quantity_delivered:     { type: float, default: 0 }
     katao_order_product_id: { type: integer, foreignTable: katao_order_product, foreignReference: id, onDelete: setnull }
     created_at:
     updated_at:
@@ -255,9 +256,9 @@ propel:
     product_price_euro:  { type: float, required: true }
     product_margin:      { type: float }
     product_tva_rate:    { type: float, default: 0 }
-    quantity:            { type: integer, required: true, default: 1 }
-    quantity_received:   { type: integer, default: 0 }
-    quantity_delivered:  { type: integer, default: 0 }
+    quantity:            { type: float, required: true, default: 1 }
+    quantity_received:   { type: float, default: 0 }
+    quantity_delivered:  { type: float, default: 0 }
     has_been_received:   { type: integer, size: 1, default: 0 }
     has_been_delivered:  { type: integer, size: 1, default: 0 }
     created_at:
@@ -295,8 +296,8 @@ propel:
     product_price_euro:     { type: float, required: true }
     product_margin:         { type: float }
     product_tva_rate:       { type: float, default: 0 }
-    quantity:               { type: integer, required: true, default: 1 }
-    quantity_delivered:     { type: integer, default: 0 }
+    quantity:               { type: float, required: true, default: 1 }
+    quantity_delivered:     { type: float, default: 0 }
     sol_amount:             { type: integer, default: 0 }
     created_at:
     updated_at:
@@ -373,7 +374,7 @@ propel:
     product_price_euro:        { type: float, required: true }
     product_margin:            { type: float }
     product_tva_rate:          { type: float, default: 0 }
-    quantity:                  { type: integer, required: true, default: 1 }
+    quantity:                  { type: float, required: true, default: 1 }
     product_price_total:       { type: float, default: 0 }
     created_at:
     updated_at:

+ 10 - 9
data/sql/lib.model.schema.sql

@@ -242,6 +242,7 @@ CREATE TABLE `katao_product`
 	`katao_supplier_id` INTEGER  NOT NULL,
 	`max_sol_amount` INTEGER,
 	`unit_price_euro` FLOAT  NOT NULL,
+	`authorize_decimal` INTEGER(1) default 0,
 	`margin` FLOAT,
 	`tva_rate` FLOAT default 0,
 	`min_order_number` INTEGER default 1 NOT NULL,
@@ -591,10 +592,10 @@ CREATE TABLE `katao_cart_product`
 	`product_price_euro` FLOAT  NOT NULL,
 	`product_margin` FLOAT,
 	`product_tva_rate` FLOAT default 0,
-	`quantity` INTEGER default 1 NOT NULL,
-	`quantity_adjusted` INTEGER default 0,
+	`quantity` FLOAT default 1 NOT NULL,
+	`quantity_adjusted` FLOAT default 0,
 	`has_been_adjusted` INTEGER(1) default 0,
-	`quantity_delivered` INTEGER default 0,
+	`quantity_delivered` FLOAT default 0,
 	`katao_order_product_id` INTEGER,
 	`created_at` DATETIME,
 	`updated_at` DATETIME,
@@ -680,9 +681,9 @@ CREATE TABLE `katao_order_product`
 	`product_price_euro` FLOAT  NOT NULL,
 	`product_margin` FLOAT,
 	`product_tva_rate` FLOAT default 0,
-	`quantity` INTEGER default 1 NOT NULL,
-	`quantity_received` INTEGER default 0,
-	`quantity_delivered` INTEGER default 0,
+	`quantity` FLOAT default 1 NOT NULL,
+	`quantity_received` FLOAT default 0,
+	`quantity_delivered` FLOAT default 0,
 	`has_been_received` INTEGER(1) default 0,
 	`has_been_delivered` INTEGER(1) default 0,
 	`created_at` DATETIME,
@@ -772,8 +773,8 @@ CREATE TABLE `katao_invoice_product`
 	`product_price_euro` FLOAT  NOT NULL,
 	`product_margin` FLOAT,
 	`product_tva_rate` FLOAT default 0,
-	`quantity` INTEGER default 1 NOT NULL,
-	`quantity_delivered` INTEGER default 0,
+	`quantity` FLOAT default 1 NOT NULL,
+	`quantity_delivered` FLOAT default 0,
 	`sol_amount` INTEGER default 0,
 	`created_at` DATETIME,
 	`updated_at` DATETIME,
@@ -939,7 +940,7 @@ CREATE TABLE `katao_supplier_invoice_product`
 	`product_price_euro` FLOAT  NOT NULL,
 	`product_margin` FLOAT,
 	`product_tva_rate` FLOAT default 0,
-	`quantity` INTEGER default 1 NOT NULL,
+	`quantity` FLOAT default 1 NOT NULL,
 	`product_price_total` FLOAT default 0,
 	`created_at` DATETIME,
 	`updated_at` DATETIME,

+ 19 - 0
data/sql/patch_2018-11-14_gestion-decimales.sql

@@ -0,0 +1,19 @@
+SET AUTOCOMMIT = 0;
+START TRANSACTION;
+
+ALTER TABLE `katao_product` ADD `authorize_decimal` INTEGER(1) default 0 AFTER `unit_price_euro`;
+
+ALTER TABLE `katao_cart_product` MODIFY `quantity` FLOAT;
+ALTER TABLE `katao_cart_product` MODIFY `quantity_delivered` FLOAT;
+ALTER TABLE `katao_cart_product` MODIFY `quantity_adjusted` FLOAT;
+
+ALTER TABLE `katao_order_product` MODIFY `quantity` FLOAT;
+ALTER TABLE `katao_order_product` MODIFY `quantity_received` FLOAT;
+ALTER TABLE `katao_order_product` MODIFY `quantity_delivered` FLOAT;
+
+ALTER TABLE `katao_invoice_product` MODIFY `quantity` FLOAT;
+ALTER TABLE `katao_invoice_product` MODIFY `quantity_delivered` FLOAT;
+
+ALTER TABLE `katao_supplier_invoice_product` MODIFY `quantity` FLOAT;
+
+COMMIT;

+ 6 - 0
lib/form/KataoProductForm.class.php

@@ -52,6 +52,11 @@ class KataoProductForm extends BaseKataoProductForm {
 		if ((bool)$this->getObject()->getIsArchived()) {
 			$this->widgetSchema['is_archived']->setAttribute('checked', 'checked');
 		}
+		$this->widgetSchema['authorize_decimal'] = new wpWidgetFormInputCheckbox();
+		$this->widgetSchema['authorize_decimal']->setOption('value_attribute_value', 1);
+		if ((bool)$this->getObject()->getAuthorizeDecimal()) {
+			$this->widgetSchema['authorize_decimal']->setAttribute('checked', 'checked');
+		}
 
 		$this->widgetSchema['picture'] = new wpWidgetFormInputFile(array(), array('file_src' => $this->getObject()->getPicture()));
 		$this->validatorSchema['picture'] = new sfValidatorFile(array('required' => false, 'mime_types' => array('image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'image/gif', 'image/jpeg; charset=binary')), array('mime_types' => 'Merci de choisir une image au format jpg, png ou gif (%mime_type%)'));
@@ -71,6 +76,7 @@ class KataoProductForm extends BaseKataoProductForm {
 				'is_archived' => 'Archivé ?',
 				'accounting_code_purchase' => 'Achat',
 				'accounting_code_sell' => 'Vente',
+				'authorize_decimal' => 'Autoriser quantités avec décimales',
 				));
 
 		$this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'checkMaxSolAmount')), array('invalid' => 'Le montant de la monnaie complémentaire est trop important.')));

+ 6 - 6
lib/form/base/BaseKataoCartProductForm.class.php

@@ -20,10 +20,10 @@ class BaseKataoCartProductForm extends BaseFormPropel
       'product_price_euro'     => new sfWidgetFormInput(),
       'product_margin'         => new sfWidgetFormInput(),
       'product_tva_rate'       => new sfWidgetFormInput(),
-      'quantity'               => new sfWidgetFormInput(),
-      'quantity_adjusted'      => new sfWidgetFormInput(),
+      'quantity'               => new sfWidgetFormInputNumber(),
+      'quantity_adjusted'      => new sfWidgetFormInputNumber(),
       'has_been_adjusted'      => new sfWidgetFormInput(),
-      'quantity_delivered'     => new sfWidgetFormInput(),
+      'quantity_delivered'     => new sfWidgetFormInputNumber(),
       'katao_order_product_id' => new sfWidgetFormPropelSelect(array('model' => 'KataoOrderProduct', 'add_empty' => true)),
       'created_at'             => new sfWidgetFormDateTime(),
       'updated_at'             => new sfWidgetFormDateTime(),
@@ -38,10 +38,10 @@ class BaseKataoCartProductForm extends BaseFormPropel
       'product_price_euro'     => new sfValidatorNumber(),
       'product_margin'         => new sfValidatorNumber(array('required' => false)),
       'product_tva_rate'       => new sfValidatorNumber(array('required' => false)),
-      'quantity'               => new sfValidatorInteger(),
-      'quantity_adjusted'      => new sfValidatorInteger(array('required' => false)),
+      'quantity'               => new sfValidatorNumber(),
+      'quantity_adjusted'      => new sfValidatorNumber(array('required' => false)),
       'has_been_adjusted'      => new sfValidatorInteger(array('required' => false)),
-      'quantity_delivered'     => new sfValidatorInteger(array('required' => false)),
+      'quantity_delivered'     => new sfValidatorNumber(array('required' => false)),
       'katao_order_product_id' => new sfValidatorPropelChoice(array('model' => 'KataoOrderProduct', 'column' => 'id', 'required' => false)),
       'created_at'             => new sfValidatorDateTime(array('required' => false)),
       'updated_at'             => new sfValidatorDateTime(array('required' => false)),

+ 4 - 4
lib/form/base/BaseKataoInvoiceProductForm.class.php

@@ -22,8 +22,8 @@ class BaseKataoInvoiceProductForm extends BaseFormPropel
       'product_price_euro'     => new sfWidgetFormInput(),
       'product_margin'         => new sfWidgetFormInput(),
       'product_tva_rate'       => new sfWidgetFormInput(),
-      'quantity'               => new sfWidgetFormInput(),
-      'quantity_delivered'     => new sfWidgetFormInput(),
+      'quantity'               => new sfWidgetFormInputNumber(),
+      'quantity_delivered'     => new sfWidgetFormInputNumber(),
       'sol_amount'             => new sfWidgetFormInput(),
       'created_at'             => new sfWidgetFormDateTime(),
       'updated_at'             => new sfWidgetFormDateTime(),
@@ -40,8 +40,8 @@ class BaseKataoInvoiceProductForm extends BaseFormPropel
       'product_price_euro'     => new sfValidatorNumber(),
       'product_margin'         => new sfValidatorNumber(array('required' => false)),
       'product_tva_rate'       => new sfValidatorNumber(array('required' => false)),
-      'quantity'               => new sfValidatorInteger(),
-      'quantity_delivered'     => new sfValidatorInteger(array('required' => false)),
+      'quantity'               => new sfValidatorNumber(),
+      'quantity_delivered'     => new sfValidatorNumber(array('required' => false)),
       'sol_amount'             => new sfValidatorInteger(array('required' => false)),
       'created_at'             => new sfValidatorDateTime(array('required' => false)),
       'updated_at'             => new sfValidatorDateTime(array('required' => false)),

+ 6 - 6
lib/form/base/BaseKataoOrderProductForm.class.php

@@ -20,9 +20,9 @@ class BaseKataoOrderProductForm extends BaseFormPropel
       'product_price_euro' => new sfWidgetFormInput(),
       'product_margin'     => new sfWidgetFormInput(),
       'product_tva_rate'   => new sfWidgetFormInput(),
-      'quantity'           => new sfWidgetFormInput(),
-      'quantity_received'  => new sfWidgetFormInput(),
-      'quantity_delivered' => new sfWidgetFormInput(),
+      'quantity'           => new sfWidgetFormInputNumber(),
+      'quantity_received'  => new sfWidgetFormInputNumber(),
+      'quantity_delivered' => new sfWidgetFormInputNumber(),
       'has_been_received'  => new sfWidgetFormInput(),
       'has_been_delivered' => new sfWidgetFormInput(),
       'created_at'         => new sfWidgetFormDateTime(),
@@ -38,9 +38,9 @@ class BaseKataoOrderProductForm extends BaseFormPropel
       'product_price_euro' => new sfValidatorNumber(),
       'product_margin'     => new sfValidatorNumber(array('required' => false)),
       'product_tva_rate'   => new sfValidatorNumber(array('required' => false)),
-      'quantity'           => new sfValidatorInteger(),
-      'quantity_received'  => new sfValidatorInteger(array('required' => false)),
-      'quantity_delivered' => new sfValidatorInteger(array('required' => false)),
+      'quantity'           => new sfValidatorNumber(),
+      'quantity_received'  => new sfValidatorNumber(array('required' => false)),
+      'quantity_delivered' => new sfValidatorNumber(array('required' => false)),
       'has_been_received'  => new sfValidatorInteger(array('required' => false)),
       'has_been_delivered' => new sfValidatorInteger(array('required' => false)),
       'created_at'         => new sfValidatorDateTime(array('required' => false)),

+ 2 - 0
lib/form/base/BaseKataoProductForm.class.php

@@ -27,6 +27,7 @@ class BaseKataoProductForm extends BaseFormPropel
       'picture'                  => new sfWidgetFormInput(),
       'delivery_delay'           => new sfWidgetFormInput(),
       'is_archived'              => new sfWidgetFormInput(),
+      'authorize_decimal'       => new sfWidgetFormInput(),
       'accounting_code_purchase' => new sfWidgetFormInput(),
       'accounting_code_sell'     => new sfWidgetFormInput(),
       'created_at'               => new sfWidgetFormDateTime(),
@@ -49,6 +50,7 @@ class BaseKataoProductForm extends BaseFormPropel
       'picture'                  => new sfValidatorString(array('max_length' => 255, 'required' => false)),
       'delivery_delay'           => new sfValidatorInteger(array('required' => false)),
       'is_archived'              => new sfValidatorInteger(array('required' => false)),
+      'authorize_decimal'       => new sfValidatorInteger(array('required' => false)),
       'accounting_code_purchase' => new sfValidatorString(array('max_length' => 12)),
       'accounting_code_sell'     => new sfValidatorString(array('max_length' => 12)),
       'created_at'               => new sfValidatorDateTime(array('required' => false)),

+ 2 - 2
lib/form/base/BaseKataoSupplierInvoiceProductForm.class.php

@@ -20,7 +20,7 @@ class BaseKataoSupplierInvoiceProductForm extends BaseFormPropel
       'product_price_euro'        => new sfWidgetFormInput(),
       'product_margin'            => new sfWidgetFormInput(),
       'product_tva_rate'          => new sfWidgetFormInput(),
-      'quantity'                  => new sfWidgetFormInput(),
+      'quantity'                  => new sfWidgetFormInputNumber(),
       'product_price_total'       => new sfWidgetFormInput(),
       'created_at'                => new sfWidgetFormDateTime(),
       'updated_at'                => new sfWidgetFormDateTime(),
@@ -35,7 +35,7 @@ class BaseKataoSupplierInvoiceProductForm extends BaseFormPropel
       'product_price_euro'        => new sfValidatorNumber(),
       'product_margin'            => new sfValidatorNumber(array('required' => false)),
       'product_tva_rate'          => new sfValidatorNumber(array('required' => false)),
-      'quantity'                  => new sfValidatorInteger(),
+      'quantity'                  => new sfValidatorNumber(),
       'product_price_total'       => new sfValidatorNumber(array('required' => false)),
       'created_at'                => new sfValidatorDateTime(array('required' => false)),
       'updated_at'                => new sfValidatorDateTime(array('required' => false)),

+ 2 - 2
lib/model/KataoCartProductPeer.php

@@ -44,7 +44,7 @@ class KataoCartProductPeer extends BaseKataoCartProductPeer {
      * KataoCartProductPeer::n()
      *
      * @param int $id
-     * @param int $quantity
+     * @param float $quantity
      * @return
      */
     public static function adjustQuantity($id, $quantity) {
@@ -60,7 +60,7 @@ class KataoCartProductPeer extends BaseKataoCartProductPeer {
      * KataoCartProductPeer::deliverQuantity()
      *
      * @param int $id
-     * @param int $quantity
+     * @param float $quantity
      * @return
      */
     public static function deliverQuantity($id, $quantity) {

+ 3 - 3
lib/model/KataoOrder.php

@@ -64,7 +64,7 @@ class KataoOrder extends BaseKataoOrder {
      * KataoOrder::updateProductQuantity()
      *
      * @param int $katao_product_id
-     * @param int $katao_order_product_quantity
+     * @param float $katao_order_product_quantity
      * @return
      */
     public function updateProductQuantity($katao_product_id, $katao_order_product_quantity) {
@@ -99,7 +99,7 @@ class KataoOrder extends BaseKataoOrder {
      *
      * @param int $katao_user_id
      * @param int $katao_product_id
-     * @param int $quantity
+     * @param float $quantity
      * @return
      */
     public function addProductToUser($katao_user_id, $katao_product_id, $quantity) {
@@ -112,7 +112,7 @@ class KataoOrder extends BaseKataoOrder {
      * KataoOrder::updateProductQuantity()
      *
      * @param int $katao_product_id
-     * @param int $katao_order_product_quantity
+     * @param float $katao_order_product_quantity
      * @return KataoOrderProduct
      */
     public function getKataoOrderProductByProductId($katao_product_id) {

+ 1 - 1
lib/model/KataoOrderProduct.php

@@ -36,7 +36,7 @@ class KataoOrderProduct extends BaseKataoOrderProduct {
      * KataoOrderProduct::addProductToUser()
      *
      * @param int $katao_user_id
-     * @param int $quantity
+     * @param float $quantity
      * @return
      */
     public function addProductToUser($katao_user_id, $quantity) {

+ 1 - 1
lib/model/KataoOrderProductPeer.php

@@ -10,7 +10,7 @@ class KataoOrderProductPeer extends BaseKataoOrderProductPeer {
      * KataoOrderProductPeer::receiveQuantity()
      *
      * @param int $id
-     * @param int $quantity
+     * @param float $quantity
      * @return
      */
     public static function receiveQuantity($id, $quantity) {

+ 11 - 6
lib/model/KataoProduct.php

@@ -75,7 +75,7 @@ class KataoProduct extends BaseKataoProduct {
 
         $rs = KataoProductPeer::doSelectRS($criteria);
         if ($rs->next()) {
-            $return = $rs->getInt(2);
+            $return = number_format($rs->getFloat(2), 3);
         }
 
         return $return;
@@ -174,7 +174,8 @@ class KataoProduct extends BaseKataoProduct {
     public function getOrderDetails($katao_period_id, $katao_node_id, $with_adjusted_quantity = false) {
         $completed_packages = $this->getCompletedPackages($katao_period_id, $katao_node_id, $with_adjusted_quantity);
         $last_incomplete_package = $this->getLastIncompletePackageQuantity($katao_period_id, $katao_node_id, $with_adjusted_quantity);
-        return sprintf('%d (%d / %d)%s', $completed_packages, $last_incomplete_package, $this->getMinOrderNumber(), ($completed_packages || $last_incomplete_package)?sprintf(' %s', image_tag($last_incomplete_package?'actions/bullet_red.png':'actions/bullet_green.png', array('alt' => $last_incomplete_package?'Colis incomplet':'Colis complet', 'title' => $last_incomplete_package?'Colis incomplet':'Colis complet', 'align' => 'top'))):'');
+        $format_quantity = $this->getAuthorizeDecimal()?'%.3f':'%d';
+        return sprintf('%d ('.$format_quantity.' / %d)%s', $completed_packages, $last_incomplete_package, $this->getMinOrderNumber(), ($completed_packages || $last_incomplete_package)?sprintf(' %s', image_tag($last_incomplete_package?'actions/bullet_red.png':'actions/bullet_green.png', array('alt' => $last_incomplete_package?'Colis incomplet':'Colis complet', 'title' => $last_incomplete_package?'Colis incomplet':'Colis complet', 'align' => 'top'))):'');
     }
 
     public function getUnitPriceEuroStr() {
@@ -185,6 +186,10 @@ class KataoProduct extends BaseKataoProduct {
         return $this->getIsArchived()?'Oui':'Non';
     }
 
+    public function getAuthorizeDecimalStr() {
+        return $this->getAuthorizeDecimal()?'Oui':'Non';
+    }
+
     public function getRealPicture() {
         return $this->hasPicture()?$this->getPicture():(wpConfig::hasDefaultProductPicture()?wpConfig::getDefaultProductPicture():'img04.gif');
     }
@@ -289,7 +294,7 @@ L\'équipe KATAO', $this->getName(), $this->getReference(), Utils::formatCurrenc
      *
      * @param int $katao_period_id
      * @param int $katao_node_id
-     * @return int
+     * @return float
      */
     public function getTotalReceivedQuantity($katao_period_id, $katao_node_id) {
         $return = 0;
@@ -303,7 +308,7 @@ L\'équipe KATAO', $this->getName(), $this->getReference(), Utils::formatCurrenc
 
         $rs = KataoOrderProductPeer::doSelectRS($criteria);
         if ($rs->next()) {
-            $return = $rs->getInt(1);
+            $return = number_format($rs->getFloat(1), 3);
         }
 
         return $return;
@@ -314,7 +319,7 @@ L\'équipe KATAO', $this->getName(), $this->getReference(), Utils::formatCurrenc
      *
      * @param int $katao_period_id
      * @param int $katao_node_id
-     * @return int
+     * @return float
      */
     public function getTotalDeliveredQuantity($katao_invoice_id = false, $katao_period_id, $katao_node_id) {
         $return = 0;
@@ -331,7 +336,7 @@ L\'équipe KATAO', $this->getName(), $this->getReference(), Utils::formatCurrenc
 
         $rs = KataoInvoiceProductPeer::doSelectRS($criteria);
         while ($rs->next()) {
-            $return += $rs->getInt(1);
+            $return += number_format($rs->getFloat(1), 3);
         }
 
         return $return;

+ 1 - 1
lib/model/KataoUser.php

@@ -111,7 +111,7 @@ class KataoUser extends BaseKataoUser {
      * KataoUser::addProductToCart()
      *
      * @param integer $product_id
-     * @param integer $quantity
+     * @param float $quantity
      * @return
      */
     public function addProductToCart($product_id, $quantity = 1) {

+ 3 - 3
lib/model/map/KataoCartProductMapBuilder.php

@@ -77,13 +77,13 @@ class KataoCartProductMapBuilder {
 
 		$tMap->addColumn('PRODUCT_TVA_RATE', 'ProductTvaRate', 'double', CreoleTypes::FLOAT, false, null);
 
-		$tMap->addColumn('QUANTITY', 'Quantity', 'int', CreoleTypes::INTEGER, true, null);
+		$tMap->addColumn('QUANTITY', 'Quantity', 'double', CreoleTypes::FLOAT, true, null);
 
-		$tMap->addColumn('QUANTITY_ADJUSTED', 'QuantityAdjusted', 'int', CreoleTypes::INTEGER, false, null);
+		$tMap->addColumn('QUANTITY_ADJUSTED', 'QuantityAdjusted', 'double', CreoleTypes::FLOAT, false, null);
 
 		$tMap->addColumn('HAS_BEEN_ADJUSTED', 'HasBeenAdjusted', 'int', CreoleTypes::INTEGER, false, 1);
 
-		$tMap->addColumn('QUANTITY_DELIVERED', 'QuantityDelivered', 'int', CreoleTypes::INTEGER, false, null);
+		$tMap->addColumn('QUANTITY_DELIVERED', 'QuantityDelivered', 'double', CreoleTypes::FLOAT, false, null);
 
 		$tMap->addForeignKey('KATAO_ORDER_PRODUCT_ID', 'KataoOrderProductId', 'int', CreoleTypes::INTEGER, 'katao_order_product', 'ID', false, null);
 

+ 2 - 2
lib/model/map/KataoInvoiceProductMapBuilder.php

@@ -81,9 +81,9 @@ class KataoInvoiceProductMapBuilder {
 
 		$tMap->addColumn('PRODUCT_TVA_RATE', 'ProductTvaRate', 'double', CreoleTypes::FLOAT, false, null);
 
-		$tMap->addColumn('QUANTITY', 'Quantity', 'int', CreoleTypes::INTEGER, true, null);
+		$tMap->addColumn('QUANTITY', 'Quantity', 'double', CreoleTypes::FLOAT, true, null);
 
-		$tMap->addColumn('QUANTITY_DELIVERED', 'QuantityDelivered', 'int', CreoleTypes::INTEGER, false, null);
+		$tMap->addColumn('QUANTITY_DELIVERED', 'QuantityDelivered', 'double', CreoleTypes::FLOAT, false, null);
 
 		$tMap->addColumn('SOL_AMOUNT', 'SolAmount', 'int', CreoleTypes::INTEGER, false, null);
 

+ 3 - 3
lib/model/map/KataoOrderProductMapBuilder.php

@@ -77,11 +77,11 @@ class KataoOrderProductMapBuilder {
 
 		$tMap->addColumn('PRODUCT_TVA_RATE', 'ProductTvaRate', 'double', CreoleTypes::FLOAT, false, null);
 
-		$tMap->addColumn('QUANTITY', 'Quantity', 'int', CreoleTypes::INTEGER, true, null);
+		$tMap->addColumn('QUANTITY', 'Quantity', 'double', CreoleTypes::FLOAT, true, null);
 
-		$tMap->addColumn('QUANTITY_RECEIVED', 'QuantityReceived', 'int', CreoleTypes::INTEGER, false, null);
+		$tMap->addColumn('QUANTITY_RECEIVED', 'QuantityReceived', 'double', CreoleTypes::FLOAT, false, null);
 
-		$tMap->addColumn('QUANTITY_DELIVERED', 'QuantityDelivered', 'int', CreoleTypes::INTEGER, false, null);
+		$tMap->addColumn('QUANTITY_DELIVERED', 'QuantityDelivered', 'double', CreoleTypes::FLOAT, false, null);
 
 		$tMap->addColumn('HAS_BEEN_RECEIVED', 'HasBeenReceived', 'int', CreoleTypes::INTEGER, false, 1);
 

+ 2 - 0
lib/model/map/KataoProductMapBuilder.php

@@ -79,6 +79,8 @@ class KataoProductMapBuilder {
 
 		$tMap->addColumn('UNIT_PRICE_EURO', 'UnitPriceEuro', 'double', CreoleTypes::FLOAT, true, null);
 
+		$tMap->addColumn('AUTHORIZE_DECIMAL', 'AuthorizeDecimal', 'boolean', CreoleTypes::BOOLEAN, false, 1);
+
 		$tMap->addColumn('MARGIN', 'Margin', 'double', CreoleTypes::FLOAT, false, null);
 
 		$tMap->addColumn('TVA_RATE', 'TvaRate', 'double', CreoleTypes::FLOAT, false, null);

+ 1 - 1
lib/model/map/KataoSupplierInvoiceProductMapBuilder.php

@@ -77,7 +77,7 @@ class KataoSupplierInvoiceProductMapBuilder {
 
 		$tMap->addColumn('PRODUCT_TVA_RATE', 'ProductTvaRate', 'double', CreoleTypes::FLOAT, false, null);
 
-		$tMap->addColumn('QUANTITY', 'Quantity', 'int', CreoleTypes::INTEGER, true, null);
+		$tMap->addColumn('QUANTITY', 'Quantity', 'double', CreoleTypes::FLOAT, true, null);
 
 		$tMap->addColumn('PRODUCT_PRICE_TOTAL', 'ProductPriceTotal', 'double', CreoleTypes::FLOAT, false, null);
 

+ 12 - 30
lib/model/om/BaseKataoCartProduct.php

@@ -77,14 +77,14 @@ abstract class BaseKataoCartProduct extends BaseObject  implements Persistent {
 
 	/**
 	 * The value for the quantity field.
-	 * @var        int
+	 * @var        double
 	 */
 	protected $quantity = 1;
 
 
 	/**
 	 * The value for the quantity_adjusted field.
-	 * @var        int
+	 * @var        double
 	 */
 	protected $quantity_adjusted = 0;
 
@@ -98,7 +98,7 @@ abstract class BaseKataoCartProduct extends BaseObject  implements Persistent {
 
 	/**
 	 * The value for the quantity_delivered field.
-	 * @var        int
+	 * @var        double
 	 */
 	protected $quantity_delivered = 0;
 
@@ -255,7 +255,7 @@ abstract class BaseKataoCartProduct extends BaseObject  implements Persistent {
 	/**
 	 * Get the [quantity] column value.
 	 * 
-	 * @return     int
+	 * @return     double
 	 */
 	public function getQuantity()
 	{
@@ -266,7 +266,7 @@ abstract class BaseKataoCartProduct extends BaseObject  implements Persistent {
 	/**
 	 * Get the [quantity_adjusted] column value.
 	 * 
-	 * @return     int
+	 * @return     double
 	 */
 	public function getQuantityAdjusted()
 	{
@@ -288,7 +288,7 @@ abstract class BaseKataoCartProduct extends BaseObject  implements Persistent {
 	/**
 	 * Get the [quantity_delivered] column value.
 	 * 
-	 * @return     int
+	 * @return     double
 	 */
 	public function getQuantityDelivered()
 	{
@@ -538,18 +538,12 @@ abstract class BaseKataoCartProduct extends BaseObject  implements Persistent {
 	/**
 	 * Set the value of [quantity] column.
 	 * 
-	 * @param      int $v new value
+	 * @param      double $v new value
 	 * @return     void
 	 */
 	public function setQuantity($v)
 	{
 
-		// Since the native PHP type for this column is integer,
-		// we will cast the input value to an int (if it is not).
-		if ($v !== null && !is_int($v) && is_numeric($v)) {
-			$v = (int) $v;
-		}
-
 		if ($this->quantity !== $v || $v === 1) {
 			$this->quantity = $v;
 			$this->modifiedColumns[] = KataoCartProductPeer::QUANTITY;
@@ -560,18 +554,12 @@ abstract class BaseKataoCartProduct extends BaseObject  implements Persistent {
 	/**
 	 * Set the value of [quantity_adjusted] column.
 	 * 
-	 * @param      int $v new value
+	 * @param      double $v new value
 	 * @return     void
 	 */
 	public function setQuantityAdjusted($v)
 	{
 
-		// Since the native PHP type for this column is integer,
-		// we will cast the input value to an int (if it is not).
-		if ($v !== null && !is_int($v) && is_numeric($v)) {
-			$v = (int) $v;
-		}
-
 		if ($this->quantity_adjusted !== $v || $v === 0) {
 			$this->quantity_adjusted = $v;
 			$this->modifiedColumns[] = KataoCartProductPeer::QUANTITY_ADJUSTED;
@@ -604,18 +592,12 @@ abstract class BaseKataoCartProduct extends BaseObject  implements Persistent {
 	/**
 	 * Set the value of [quantity_delivered] column.
 	 * 
-	 * @param      int $v new value
+	 * @param      double $v new value
 	 * @return     void
 	 */
 	public function setQuantityDelivered($v)
 	{
 
-		// Since the native PHP type for this column is integer,
-		// we will cast the input value to an int (if it is not).
-		if ($v !== null && !is_int($v) && is_numeric($v)) {
-			$v = (int) $v;
-		}
-
 		if ($this->quantity_delivered !== $v || $v === 0) {
 			$this->quantity_delivered = $v;
 			$this->modifiedColumns[] = KataoCartProductPeer::QUANTITY_DELIVERED;
@@ -730,13 +712,13 @@ abstract class BaseKataoCartProduct extends BaseObject  implements Persistent {
 
 			$this->product_tva_rate = $rs->getFloat($startcol + 7);
 
-			$this->quantity = $rs->getInt($startcol + 8);
+			$this->quantity = $rs->getFloat($startcol + 8);
 
-			$this->quantity_adjusted = $rs->getInt($startcol + 9);
+			$this->quantity_adjusted = $rs->getFloat($startcol + 9);
 
 			$this->has_been_adjusted = $rs->getInt($startcol + 10);
 
-			$this->quantity_delivered = $rs->getInt($startcol + 11);
+			$this->quantity_delivered = $rs->getFloat($startcol + 11);
 
 			$this->katao_order_product_id = $rs->getInt($startcol + 12);
 

+ 8 - 20
lib/model/om/BaseKataoInvoiceProduct.php

@@ -91,14 +91,14 @@ abstract class BaseKataoInvoiceProduct extends BaseObject  implements Persistent
 
 	/**
 	 * The value for the quantity field.
-	 * @var        int
+	 * @var        double
 	 */
 	protected $quantity = 1;
 
 
 	/**
 	 * The value for the quantity_delivered field.
-	 * @var        int
+	 * @var        double
 	 */
 	protected $quantity_delivered = 0;
 
@@ -270,7 +270,7 @@ abstract class BaseKataoInvoiceProduct extends BaseObject  implements Persistent
 	/**
 	 * Get the [quantity] column value.
 	 * 
-	 * @return     int
+	 * @return     double
 	 */
 	public function getQuantity()
 	{
@@ -281,7 +281,7 @@ abstract class BaseKataoInvoiceProduct extends BaseObject  implements Persistent
 	/**
 	 * Get the [quantity_delivered] column value.
 	 * 
-	 * @return     int
+	 * @return     double
 	 */
 	public function getQuantityDelivered()
 	{
@@ -583,18 +583,12 @@ abstract class BaseKataoInvoiceProduct extends BaseObject  implements Persistent
 	/**
 	 * Set the value of [quantity] column.
 	 * 
-	 * @param      int $v new value
+	 * @param      double $v new value
 	 * @return     void
 	 */
 	public function setQuantity($v)
 	{
 
-		// Since the native PHP type for this column is integer,
-		// we will cast the input value to an int (if it is not).
-		if ($v !== null && !is_int($v) && is_numeric($v)) {
-			$v = (int) $v;
-		}
-
 		if ($this->quantity !== $v || $v === 1) {
 			$this->quantity = $v;
 			$this->modifiedColumns[] = KataoInvoiceProductPeer::QUANTITY;
@@ -605,18 +599,12 @@ abstract class BaseKataoInvoiceProduct extends BaseObject  implements Persistent
 	/**
 	 * Set the value of [quantity_delivered] column.
 	 * 
-	 * @param      int $v new value
+	 * @param      double $v new value
 	 * @return     void
 	 */
 	public function setQuantityDelivered($v)
 	{
 
-		// Since the native PHP type for this column is integer,
-		// we will cast the input value to an int (if it is not).
-		if ($v !== null && !is_int($v) && is_numeric($v)) {
-			$v = (int) $v;
-		}
-
 		if ($this->quantity_delivered !== $v || $v === 0) {
 			$this->quantity_delivered = $v;
 			$this->modifiedColumns[] = KataoInvoiceProductPeer::QUANTITY_DELIVERED;
@@ -731,9 +719,9 @@ abstract class BaseKataoInvoiceProduct extends BaseObject  implements Persistent
 
 			$this->product_tva_rate = $rs->getFloat($startcol + 9);
 
-			$this->quantity = $rs->getInt($startcol + 10);
+			$this->quantity = $rs->getFloat($startcol + 10);
 
-			$this->quantity_delivered = $rs->getInt($startcol + 11);
+			$this->quantity_delivered = $rs->getFloat($startcol + 11);
 
 			$this->sol_amount = $rs->getInt($startcol + 12);
 

+ 12 - 30
lib/model/om/BaseKataoOrderProduct.php

@@ -77,21 +77,21 @@ abstract class BaseKataoOrderProduct extends BaseObject  implements Persistent {
 
 	/**
 	 * The value for the quantity field.
-	 * @var        int
+	 * @var        double
 	 */
 	protected $quantity = 1;
 
 
 	/**
 	 * The value for the quantity_received field.
-	 * @var        int
+	 * @var        double
 	 */
 	protected $quantity_received = 0;
 
 
 	/**
 	 * The value for the quantity_delivered field.
-	 * @var        int
+	 * @var        double
 	 */
 	protected $quantity_delivered = 0;
 
@@ -262,7 +262,7 @@ abstract class BaseKataoOrderProduct extends BaseObject  implements Persistent {
 	/**
 	 * Get the [quantity] column value.
 	 * 
-	 * @return     int
+	 * @return     double
 	 */
 	public function getQuantity()
 	{
@@ -273,7 +273,7 @@ abstract class BaseKataoOrderProduct extends BaseObject  implements Persistent {
 	/**
 	 * Get the [quantity_received] column value.
 	 * 
-	 * @return     int
+	 * @return     double
 	 */
 	public function getQuantityReceived()
 	{
@@ -284,7 +284,7 @@ abstract class BaseKataoOrderProduct extends BaseObject  implements Persistent {
 	/**
 	 * Get the [quantity_delivered] column value.
 	 * 
-	 * @return     int
+	 * @return     double
 	 */
 	public function getQuantityDelivered()
 	{
@@ -545,18 +545,12 @@ abstract class BaseKataoOrderProduct extends BaseObject  implements Persistent {
 	/**
 	 * Set the value of [quantity] column.
 	 * 
-	 * @param      int $v new value
+	 * @param      double $v new value
 	 * @return     void
 	 */
 	public function setQuantity($v)
 	{
 
-		// Since the native PHP type for this column is integer,
-		// we will cast the input value to an int (if it is not).
-		if ($v !== null && !is_int($v) && is_numeric($v)) {
-			$v = (int) $v;
-		}
-
 		if ($this->quantity !== $v || $v === 1) {
 			$this->quantity = $v;
 			$this->modifiedColumns[] = KataoOrderProductPeer::QUANTITY;
@@ -567,18 +561,12 @@ abstract class BaseKataoOrderProduct extends BaseObject  implements Persistent {
 	/**
 	 * Set the value of [quantity_received] column.
 	 * 
-	 * @param      int $v new value
+	 * @param      double $v new value
 	 * @return     void
 	 */
 	public function setQuantityReceived($v)
 	{
 
-		// Since the native PHP type for this column is integer,
-		// we will cast the input value to an int (if it is not).
-		if ($v !== null && !is_int($v) && is_numeric($v)) {
-			$v = (int) $v;
-		}
-
 		if ($this->quantity_received !== $v || $v === 0) {
 			$this->quantity_received = $v;
 			$this->modifiedColumns[] = KataoOrderProductPeer::QUANTITY_RECEIVED;
@@ -589,18 +577,12 @@ abstract class BaseKataoOrderProduct extends BaseObject  implements Persistent {
 	/**
 	 * Set the value of [quantity_delivered] column.
 	 * 
-	 * @param      int $v new value
+	 * @param      double $v new value
 	 * @return     void
 	 */
 	public function setQuantityDelivered($v)
 	{
 
-		// Since the native PHP type for this column is integer,
-		// we will cast the input value to an int (if it is not).
-		if ($v !== null && !is_int($v) && is_numeric($v)) {
-			$v = (int) $v;
-		}
-
 		if ($this->quantity_delivered !== $v || $v === 0) {
 			$this->quantity_delivered = $v;
 			$this->modifiedColumns[] = KataoOrderProductPeer::QUANTITY_DELIVERED;
@@ -733,11 +715,11 @@ abstract class BaseKataoOrderProduct extends BaseObject  implements Persistent {
 
 			$this->product_tva_rate = $rs->getFloat($startcol + 7);
 
-			$this->quantity = $rs->getInt($startcol + 8);
+			$this->quantity = $rs->getFloat($startcol + 8);
 
-			$this->quantity_received = $rs->getInt($startcol + 9);
+			$this->quantity_received = $rs->getFloat($startcol + 9);
 
-			$this->quantity_delivered = $rs->getInt($startcol + 10);
+			$this->quantity_delivered = $rs->getFloat($startcol + 10);
 
 			$this->has_been_received = $rs->getInt($startcol + 11);
 

+ 96 - 49
lib/model/om/BaseKataoProduct.php

@@ -82,6 +82,13 @@ abstract class BaseKataoProduct extends BaseObject  implements Persistent {
 	protected $unit_price_euro;
 
 
+	/**
+	 * The value for the authorize_decimal field.
+	 * @var        boolean
+	 */
+	protected $authorize_decimal = false;
+
+
 	/**
 	 * The value for the margin field.
 	 * @var        double
@@ -346,6 +353,17 @@ abstract class BaseKataoProduct extends BaseObject  implements Persistent {
 		return $this->unit_price_euro;
 	}
 
+	/**
+	 * Get the [authorize_decimal] column value.
+	 * 
+	 * @return     boolean
+	 */
+	public function getAuthorizeDecimal()
+	{
+
+		return $this->authorize_decimal;
+	}
+
 	/**
 	 * Get the [margin] column value.
 	 * 
@@ -696,6 +714,22 @@ abstract class BaseKataoProduct extends BaseObject  implements Persistent {
 
 	} // setUnitPriceEuro()
 
+	/**
+	 * Set the value of [authorize_decimal] column.
+	 * 
+	 * @param      boolean $v new value
+	 * @return     void
+	 */
+	public function setAuthorizeDecimal($v)
+	{
+
+		if ($this->authorize_decimal !== $v || $v === false) {
+			$this->authorize_decimal = $v;
+			$this->modifiedColumns[] = KataoProductPeer::AUTHORIZE_DECIMAL;
+		}
+
+	} // setAuthorizeDecimal()
+
 	/**
 	 * Set the value of [margin] column.
 	 * 
@@ -943,32 +977,34 @@ abstract class BaseKataoProduct extends BaseObject  implements Persistent {
 
 			$this->unit_price_euro = $rs->getFloat($startcol + 8);
 
-			$this->margin = $rs->getFloat($startcol + 9);
+			$this->authorize_decimal = $rs->getBoolean($startcol + 9);
+
+			$this->margin = $rs->getFloat($startcol + 10);
 
-			$this->tva_rate = $rs->getFloat($startcol + 10);
+			$this->tva_rate = $rs->getFloat($startcol + 11);
 
-			$this->min_order_number = $rs->getInt($startcol + 11);
+			$this->min_order_number = $rs->getInt($startcol + 12);
 
-			$this->picture = $rs->getString($startcol + 12);
+			$this->picture = $rs->getString($startcol + 13);
 
-			$this->delivery_delay = $rs->getInt($startcol + 13);
+			$this->delivery_delay = $rs->getInt($startcol + 14);
 
-			$this->is_archived = $rs->getInt($startcol + 14);
+			$this->is_archived = $rs->getInt($startcol + 15);
 
-			$this->accounting_code_purchase = $rs->getString($startcol + 15);
+			$this->accounting_code_purchase = $rs->getString($startcol + 16);
 
-			$this->accounting_code_sell = $rs->getString($startcol + 16);
+			$this->accounting_code_sell = $rs->getString($startcol + 17);
 
-			$this->created_at = $rs->getTimestamp($startcol + 17, null);
+			$this->created_at = $rs->getTimestamp($startcol + 18, null);
 
-			$this->updated_at = $rs->getTimestamp($startcol + 18, null);
+			$this->updated_at = $rs->getTimestamp($startcol + 19, null);
 
 			$this->resetModified();
 
 			$this->setNew(false);
 
 			// FIXME - using NUM_COLUMNS may be clearer.
-			return $startcol + 19; // 19 = KataoProductPeer::NUM_COLUMNS - KataoProductPeer::NUM_LAZY_LOAD_COLUMNS).
+			return $startcol + 20; // 20 = KataoProductPeer::NUM_COLUMNS - KataoProductPeer::NUM_LAZY_LOAD_COLUMNS).
 
 		} catch (Exception $e) {
 			throw new PropelException("Error populating KataoProduct object", $e);
@@ -1378,33 +1414,36 @@ abstract class BaseKataoProduct extends BaseObject  implements Persistent {
 				return $this->getUnitPriceEuro();
 				break;
 			case 9:
-				return $this->getMargin();
+				return $this->getAuthorizeDecimal();
 				break;
 			case 10:
-				return $this->getTvaRate();
+				return $this->getMargin();
 				break;
 			case 11:
-				return $this->getMinOrderNumber();
+				return $this->getTvaRate();
 				break;
 			case 12:
-				return $this->getPicture();
+				return $this->getMinOrderNumber();
 				break;
 			case 13:
-				return $this->getDeliveryDelay();
+				return $this->getPicture();
 				break;
 			case 14:
-				return $this->getIsArchived();
+				return $this->getDeliveryDelay();
 				break;
 			case 15:
-				return $this->getAccountingCodePurchase();
+				return $this->getIsArchived();
 				break;
 			case 16:
-				return $this->getAccountingCodeSell();
+				return $this->getAccountingCodePurchase();
 				break;
 			case 17:
-				return $this->getCreatedAt();
+				return $this->getAccountingCodeSell();
 				break;
 			case 18:
+				return $this->getCreatedAt();
+				break;
+			case 19:
 				return $this->getUpdatedAt();
 				break;
 			default:
@@ -1436,16 +1475,17 @@ abstract class BaseKataoProduct extends BaseObject  implements Persistent {
 			$keys[6] => $this->getKataoSupplierId(),
 			$keys[7] => $this->getMaxSolAmount(),
 			$keys[8] => $this->getUnitPriceEuro(),
-			$keys[9] => $this->getMargin(),
-			$keys[10] => $this->getTvaRate(),
-			$keys[11] => $this->getMinOrderNumber(),
-			$keys[12] => $this->getPicture(),
-			$keys[13] => $this->getDeliveryDelay(),
-			$keys[14] => $this->getIsArchived(),
-			$keys[15] => $this->getAccountingCodePurchase(),
-			$keys[16] => $this->getAccountingCodeSell(),
-			$keys[17] => $this->getCreatedAt(),
-			$keys[18] => $this->getUpdatedAt(),
+			$keys[9] => $this->getAuthorizeDecimal(),
+			$keys[10] => $this->getMargin(),
+			$keys[11] => $this->getTvaRate(),
+			$keys[12] => $this->getMinOrderNumber(),
+			$keys[13] => $this->getPicture(),
+			$keys[14] => $this->getDeliveryDelay(),
+			$keys[15] => $this->getIsArchived(),
+			$keys[16] => $this->getAccountingCodePurchase(),
+			$keys[17] => $this->getAccountingCodeSell(),
+			$keys[18] => $this->getCreatedAt(),
+			$keys[19] => $this->getUpdatedAt(),
 		);
 		return $result;
 	}
@@ -1505,33 +1545,36 @@ abstract class BaseKataoProduct extends BaseObject  implements Persistent {
 				$this->setUnitPriceEuro($value);
 				break;
 			case 9:
-				$this->setMargin($value);
+				$this->setAuthorizeDecimal($value);
 				break;
 			case 10:
-				$this->setTvaRate($value);
+				$this->setMargin($value);
 				break;
 			case 11:
-				$this->setMinOrderNumber($value);
+				$this->setTvaRate($value);
 				break;
 			case 12:
-				$this->setPicture($value);
+				$this->setMinOrderNumber($value);
 				break;
 			case 13:
-				$this->setDeliveryDelay($value);
+				$this->setPicture($value);
 				break;
 			case 14:
-				$this->setIsArchived($value);
+				$this->setDeliveryDelay($value);
 				break;
 			case 15:
-				$this->setAccountingCodePurchase($value);
+				$this->setIsArchived($value);
 				break;
 			case 16:
-				$this->setAccountingCodeSell($value);
+				$this->setAccountingCodePurchase($value);
 				break;
 			case 17:
-				$this->setCreatedAt($value);
+				$this->setAccountingCodeSell($value);
 				break;
 			case 18:
+				$this->setCreatedAt($value);
+				break;
+			case 19:
 				$this->setUpdatedAt($value);
 				break;
 		} // switch()
@@ -1566,16 +1609,17 @@ abstract class BaseKataoProduct extends BaseObject  implements Persistent {
 		if (array_key_exists($keys[6], $arr)) $this->setKataoSupplierId($arr[$keys[6]]);
 		if (array_key_exists($keys[7], $arr)) $this->setMaxSolAmount($arr[$keys[7]]);
 		if (array_key_exists($keys[8], $arr)) $this->setUnitPriceEuro($arr[$keys[8]]);
-		if (array_key_exists($keys[9], $arr)) $this->setMargin($arr[$keys[9]]);
-		if (array_key_exists($keys[10], $arr)) $this->setTvaRate($arr[$keys[10]]);
-		if (array_key_exists($keys[11], $arr)) $this->setMinOrderNumber($arr[$keys[11]]);
-		if (array_key_exists($keys[12], $arr)) $this->setPicture($arr[$keys[12]]);
-		if (array_key_exists($keys[13], $arr)) $this->setDeliveryDelay($arr[$keys[13]]);
-		if (array_key_exists($keys[14], $arr)) $this->setIsArchived($arr[$keys[14]]);
-		if (array_key_exists($keys[15], $arr)) $this->setAccountingCodePurchase($arr[$keys[15]]);
-		if (array_key_exists($keys[16], $arr)) $this->setAccountingCodeSell($arr[$keys[16]]);
-		if (array_key_exists($keys[17], $arr)) $this->setCreatedAt($arr[$keys[17]]);
-		if (array_key_exists($keys[18], $arr)) $this->setUpdatedAt($arr[$keys[18]]);
+		if (array_key_exists($keys[9], $arr)) $this->setAuthorizeDecimal($arr[$keys[9]]);
+		if (array_key_exists($keys[10], $arr)) $this->setMargin($arr[$keys[10]]);
+		if (array_key_exists($keys[11], $arr)) $this->setTvaRate($arr[$keys[11]]);
+		if (array_key_exists($keys[12], $arr)) $this->setMinOrderNumber($arr[$keys[12]]);
+		if (array_key_exists($keys[13], $arr)) $this->setPicture($arr[$keys[13]]);
+		if (array_key_exists($keys[14], $arr)) $this->setDeliveryDelay($arr[$keys[14]]);
+		if (array_key_exists($keys[15], $arr)) $this->setIsArchived($arr[$keys[15]]);
+		if (array_key_exists($keys[16], $arr)) $this->setAccountingCodePurchase($arr[$keys[16]]);
+		if (array_key_exists($keys[17], $arr)) $this->setAccountingCodeSell($arr[$keys[17]]);
+		if (array_key_exists($keys[18], $arr)) $this->setCreatedAt($arr[$keys[18]]);
+		if (array_key_exists($keys[19], $arr)) $this->setUpdatedAt($arr[$keys[19]]);
 	}
 
 	/**
@@ -1596,6 +1640,7 @@ abstract class BaseKataoProduct extends BaseObject  implements Persistent {
 		if ($this->isColumnModified(KataoProductPeer::KATAO_SUPPLIER_ID)) $criteria->add(KataoProductPeer::KATAO_SUPPLIER_ID, $this->katao_supplier_id);
 		if ($this->isColumnModified(KataoProductPeer::MAX_SOL_AMOUNT)) $criteria->add(KataoProductPeer::MAX_SOL_AMOUNT, $this->max_sol_amount);
 		if ($this->isColumnModified(KataoProductPeer::UNIT_PRICE_EURO)) $criteria->add(KataoProductPeer::UNIT_PRICE_EURO, $this->unit_price_euro);
+		if ($this->isColumnModified(KataoProductPeer::AUTHORIZE_DECIMAL)) $criteria->add(KataoProductPeer::AUTHORIZE_DECIMAL, $this->authorize_decimal);
 		if ($this->isColumnModified(KataoProductPeer::MARGIN)) $criteria->add(KataoProductPeer::MARGIN, $this->margin);
 		if ($this->isColumnModified(KataoProductPeer::TVA_RATE)) $criteria->add(KataoProductPeer::TVA_RATE, $this->tva_rate);
 		if ($this->isColumnModified(KataoProductPeer::MIN_ORDER_NUMBER)) $criteria->add(KataoProductPeer::MIN_ORDER_NUMBER, $this->min_order_number);
@@ -1676,6 +1721,8 @@ abstract class BaseKataoProduct extends BaseObject  implements Persistent {
 
 		$copyObj->setUnitPriceEuro($this->unit_price_euro);
 
+		$copyObj->setAuthorizeDecimal($this->authorize_decimal);
+
 		$copyObj->setMargin($this->margin);
 
 		$copyObj->setTvaRate($this->tva_rate);

File diff suppressed because it is too large
+ 4 - 2
lib/model/om/BaseKataoProductPeer.php


+ 4 - 10
lib/model/om/BaseKataoSupplierInvoiceProduct.php

@@ -77,7 +77,7 @@ abstract class BaseKataoSupplierInvoiceProduct extends BaseObject  implements Pe
 
 	/**
 	 * The value for the quantity field.
-	 * @var        int
+	 * @var        double
 	 */
 	protected $quantity = 1;
 
@@ -217,7 +217,7 @@ abstract class BaseKataoSupplierInvoiceProduct extends BaseObject  implements Pe
 	/**
 	 * Get the [quantity] column value.
 	 * 
-	 * @return     int
+	 * @return     double
 	 */
 	public function getQuantity()
 	{
@@ -467,18 +467,12 @@ abstract class BaseKataoSupplierInvoiceProduct extends BaseObject  implements Pe
 	/**
 	 * Set the value of [quantity] column.
 	 * 
-	 * @param      int $v new value
+	 * @param      double $v new value
 	 * @return     void
 	 */
 	public function setQuantity($v)
 	{
 
-		// Since the native PHP type for this column is integer,
-		// we will cast the input value to an int (if it is not).
-		if ($v !== null && !is_int($v) && is_numeric($v)) {
-			$v = (int) $v;
-		}
-
 		if ($this->quantity !== $v || $v === 1) {
 			$this->quantity = $v;
 			$this->modifiedColumns[] = KataoSupplierInvoiceProductPeer::QUANTITY;
@@ -583,7 +577,7 @@ abstract class BaseKataoSupplierInvoiceProduct extends BaseObject  implements Pe
 
 			$this->product_tva_rate = $rs->getFloat($startcol + 7);
 
-			$this->quantity = $rs->getInt($startcol + 8);
+			$this->quantity = $rs->getFloat($startcol + 8);
 
 			$this->product_price_total = $rs->getFloat($startcol + 9);
 

+ 27 - 0
lib/symfony/lib/helper/FormHelper.php

@@ -379,6 +379,33 @@ function input_tag($name, $value = null, $options = array())
   return tag('input', array_merge(array('type' => 'text', 'name' => $name, 'id' => get_id_from_name($name, $value), 'value' => $value), _convert_options($options)));
 }
 
+
+/**
+ * Returns an XHTML compliant <input> tag with type="number".
+ *
+ * The input_tag helper generates your basic XHTML <input> tag and can utilize any standard <input> tag parameters 
+ * passed in the optional <i>$options</i> parameter.
+ *
+ * <b>Examples:</b>
+ * <code>
+ *  echo input_number_tag('name');
+ * </code>
+ *
+ * <code>
+ *  echo input_number_tag('amount', $sf_params->get('amount'), array('size' => 8, 'maxlength' => 8));
+ * </code>
+ *
+ * @param  string $name     field name 
+ * @param  string $value    selected field value
+ * @param  array  $options  additional HTML compliant <input> tag parameters
+ *
+ * @return string XHTML compliant <input> tag with type="text"
+ */
+function input_number_tag($name, $value = null, $options = array())
+{
+  return tag('input', array_merge(array('type' => 'number', 'name' => $name, 'id' => get_id_from_name($name, $value), 'value' => $value), _convert_options($options)));
+}
+
 /**
  * Returns an XHTML compliant <input> tag with type="hidden".
  *

+ 49 - 0
lib/symfony/lib/widget/sfWidgetFormInputNumber.class.php

@@ -0,0 +1,49 @@
+<?php
+
+/*
+ * Inspired by sfWidgetFormInput.class.php
+ */
+
+/**
+ * sfWidgetFormInputNumber represents an HTML input number tag.
+ *
+ * @package    symfony
+ * @subpackage widget
+ * @author     Simon WIRTH
+ */
+class sfWidgetFormInputNumber extends sfWidgetForm
+{
+  /**
+   * Constructor.
+   *
+   * Available options:
+   *
+   *  * type: The widget type (text by default)
+   *
+   * @param array $options     An array of options
+   * @param array $attributes  An array of default HTML attributes
+   *
+   * @see sfWidgetForm
+   */
+  protected function configure($options = array(), $attributes = array())
+  {
+    $this->addOption('type', 'number');
+
+    $this->setOption('is_hidden', false);
+  }
+
+  /**
+   * @param  string $name        The element name
+   * @param  string $value       The value displayed in this widget
+   * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
+   * @param  array  $errors      An array of errors for the field
+   *
+   * @return string An HTML tag string
+   *
+   * @see sfWidgetForm
+   */
+  public function render($name, $value = null, $attributes = array(), $errors = array())
+  {
+    return $this->renderTag('input', array_merge(array('type' => $this->getOption('type'), 'name' => $name, 'value' => $value), $attributes));
+  }
+}

+ 14 - 0
plugins/catalyz/web/js/tiny_mce/plugins/imagemanager/js/mox/dom/layer.js

@@ -305,6 +305,20 @@ mox.require([
 			return parseInt(s);
 		},
 
+/**
+		 * Parses a float value this method will return 0 if the string is empty.
+		 *
+		 * @param {string} s String to parse value of.
+		 * @return Parsed number.
+		 * @type int
+		 */
+		parseFloat : function(s) {
+			if (s == null || s == '' || s == '0')
+				return 0;
+
+			return parseFloat(s);
+		},
+
 		/**
 		 * Removes the element for the layer from DOM and also the blocker iframe.
 		 */

BIN
web/images/decimals_icon.png


BIN
web/images/decimals_not_icon.png


Some files were not shown because too many files changed in this diff