From 966d079019c1dda7c3805c02f7926bfccf0563a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Tue, 28 Jan 2025 15:31:08 +0100 Subject: [PATCH] FIX: implement mdeweerd review --- htdocs/comm/propal/class/propaleligne.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/price.php | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/class/propaleligne.class.php b/htdocs/comm/propal/class/propaleligne.class.php index c300084d9600e..67c941e985165 100644 --- a/htdocs/comm/propal/class/propaleligne.class.php +++ b/htdocs/comm/propal/class/propaleligne.class.php @@ -343,7 +343,7 @@ class PropaleLigne extends CommonObjectLine */ public $multicurrency_total_ttc; - /** + /** * @var float */ public $packaging; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 55bc6ff71a1d0..7afc13938aa77 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3185,7 +3185,7 @@ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $t if ($qty < $this->line->packaging) { $qty = $this->line->packaging; } else { - if (!empty($this->line->packaging) && ($qty % $this->line->packaging) > 0) { + if (!empty($this->line->packaging) && fmod($qty, $this->line->packaging) > 0) { $coeff = intval($qty / $this->line->packaging) + 1; $qty = $this->line->packaging * $coeff; setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4964b9d992912..799b0f81835a4 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4316,7 +4316,7 @@ public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_star if ($qty < $this->line->packaging) { $qty = $this->line->packaging; } else { - if (!empty($this->line->packaging) && ($qty % $this->line->packaging) > 0) { + if (!empty($this->line->packaging) && fmod($qty, $this->line->packaging) > 0) { $coeff = intval($qty / $this->line->packaging) + 1; $qty = $this->line->packaging * $coeff; setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 368a44ecd4a58..5353e14635ce0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1592,7 +1592,7 @@ public function update($id, $user, $notrigger = 0, $action = 'update', $updatety $sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL'); $sql .= ", mandatory_period = ".($this->mandatory_period); if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING') && !empty($this->packaging)) { - $sql .= ", packaging = ".($this->packaging); + $sql .= ", packaging = " . (int) $this->packaging; } // stock field is not here because it is a denormalized value from product_stock. $sql .= " WHERE rowid = ".((int) $id); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 1984b661cabc3..e6aa4101d2f3f 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -283,7 +283,7 @@ $psq = empty($newpsq) ? 0 : $newpsq; $maxpricesupplier = $object->min_recommended_price(); - // Packaging / Conditionnement + // Packaging $packaging = getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING') ? GETPOST('packaging') : null; if (isModEnabled('dynamicprices')) { @@ -484,9 +484,9 @@ if (!$error) { $db->begin(); - // Packaging / Conditionnement + // Packaging if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $object->packaging = (double) $packaging; + $object->packaging = (float) $packaging; } foreach ($pricestoupdate as $key => $val) { @@ -1429,7 +1429,7 @@ } print ''; - // Packaging / Conditionnement + // Packaging if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { print ''.$form->textwithpicto($langs->trans("PackagingForThisProduct"), $langs->trans("PackagingForThisProductSellDesc")).''; print $object->packaging; @@ -1758,13 +1758,13 @@ function on_change() { print ''; print ''; - // Packaging / Conditionnement + // Packaging if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { print ''; print $form->textwithpicto($langs->trans("PackagingForThisProduct"), $langs->trans("PackagingForThisProductSellDesc")); print ''; $packaging = $object->packaging; - print ''; + print ''; print ''; print ''; }