diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 99a8c33cf63..398dadcb022 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1034,7 +1034,10 @@ class Propal extends CommonObject 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) + && is_numeric($this->line->packaging) + && (float) $this->line->packaging > 0 + && fmod((float) $qty, (float) $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/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index bed7fcab061..6f0b7d79b04 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3285,7 +3285,10 @@ class Commande extends CommonOrder if ($qty < $this->line->packaging) { $qty = $this->line->packaging; } else { - if (!empty($this->line->packaging) && fmod($qty, $this->line->packaging) > 0) { + if (!empty($this->line->packaging) + && is_numeric($this->line->packaging) + && (float) $this->line->packaging > 0 + && fmod((float) $qty, (float) $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 e6be3688491..45d2b9f45f0 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4660,7 +4660,10 @@ class Facture extends CommonInvoice if ($qty < $this->line->packaging) { $qty = $this->line->packaging; } else { - if (!empty($this->line->packaging) && fmod($qty, $this->line->packaging) > 0) { + if (!empty($this->line->packaging) + && is_numeric($this->line->packaging) + && (float) $this->line->packaging > 0 + && fmod((float) $qty, (float) $this->line->packaging) > 0) { $coeff = intval($qty / $this->line->packaging) + 1; $qty = $this->line->packaging * $coeff; setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');