Skip to content

Commit

Permalink
Fix: shipping workflow values comparison may fail
Browse files Browse the repository at this point in the history
Due to php internal float values (eg. 40.00000000000001 instead of 40), comparison may fail.
  • Loading branch information
jyhere authored Feb 18, 2025
1 parent cabd8a6 commit 8064fe6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
}
}
dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
if ($totalonlinkedelements == $object->total_ht) {
if (price2num($totalonlinkedelements, 'MT') == price2num($object->total_ht, 'MT')) {
foreach ($object->linkedObjects['shipping'] as $element) {
$ret = $element->setClosed();
if ($ret < 0) {
Expand All @@ -228,7 +228,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
}
}
dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".json_encode($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
if ($totalonlinkedelements == $object->total_ht) {
if (price2num($totalonlinkedelements, 'MT') == price2num($object->total_ht, 'MT')) {
foreach ($object->linkedObjects['shipping'] as $element) {
$ret = $element->setBilled();
if ($ret < 0) {
Expand Down

0 comments on commit 8064fe6

Please sign in to comment.