Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2026-01-29 13:14:14 +01:00
4 changed files with 21 additions and 18 deletions

View File

@@ -1722,12 +1722,12 @@ class Commande extends CommonOrder
$result = $tmpproduct->fetch($fk_product);
if (abs($qty) < $tmpproduct->packaging) {
$qty = (float) $tmpproduct->packaging;
setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs');
setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'warnings');
} else {
if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) {
if (!empty($tmpproduct->packaging) && (float) price2num(fmod((float) $qty, (float) $tmpproduct->packaging), 'MS')) {
$coeff = intval(abs($qty) / $tmpproduct->packaging) + 1;
$qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS');
setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs');
setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'warnings');
}
}
}
@@ -3282,14 +3282,15 @@ class Commande extends CommonOrder
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) {
if ($qty < $this->line->packaging) {
$qty = $this->line->packaging;
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'warnings');
} else {
if (!empty($this->line->packaging)
&& is_numeric($this->line->packaging)
&& (float) $this->line->packaging > 0
&& fmod((float) $qty, (float) $this->line->packaging) > 0) {
&& (float) price2num(fmod((float) $qty, (float) $this->line->packaging), 'MS')) {
$coeff = intval($qty / $this->line->packaging) + 1;
$qty = $this->line->packaging * $coeff;
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'warnings');
}
}
}