fix: divided by zero with customer packaging (#35224)
* fix: divided by zero with customer packaging * fix: divided by zero with customer packaging * fix: divided by zero with customer packaging --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
5ba8c69e63
commit
a69bd1ba56
3 changed files with 12 additions and 3 deletions
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in a new issue