From b7212cbac40a16e867436dec4353b31955ee8bd3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jan 2024 18:06:10 +0100 Subject: [PATCH 1/2] Try bette fix for #27586 --- htdocs/fourn/commande/dispatch.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 88e919881f6..31c423fd9b8 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -259,7 +259,9 @@ if ($action == 'dispatch' && $permissiontoreceive) { } // We ask to move a qty - if (GETPOST($qty) != 0) { + $qtytomove = (float) price2num(GETPOST($qty, 'alphanohtml')); + $puformove = (float) price2num(GETPOST($pu, 'alphanohtml')); + if ($qtytomove) { if (!(GETPOST($ent, 'int') > 0)) { dol_syslog('No dispatch for line '.$key.' as no warehouse was chosen.'); $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' '.($numline); @@ -268,7 +270,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { } if (!$error) { - $result = $object->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger); + $result = $object->dispatchProduct($user, GETPOSTINT($prod), $qtytomove, GETPOSTINT($ent), $puformove, GETPOST('comment'), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -327,7 +329,9 @@ if ($action == 'dispatch' && $permissiontoreceive) { } // We ask to move a qty - if (GETPOST($qty) > 0) { + $qtytomove = (float) price2num(GETPOST($qty, 'alphanohtml')); + $puformove = (float) price2num(GETPOST($pu, 'alphanohtml')); + if ($qtytomove > 0) { $productId = GETPOSTINT($prod); if (!(GETPOST($ent, 'int') > 0)) { @@ -345,7 +349,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { } if (!$error) { - $result = $object->dispatchProduct($user, $productId, GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLUO, $dDLC, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger); + $result = $object->dispatchProduct($user, $productId, $qtytomove, GETPOSTINT($ent), $puformove, GETPOST('comment'), $dDLUO, $dDLC, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; From 7acee285a862b8e5e0743df0168ce573c6758207 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jan 2024 21:07:05 +0100 Subject: [PATCH 2/2] Fix test --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 31c423fd9b8..c52c86dd262 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -261,7 +261,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { // We ask to move a qty $qtytomove = (float) price2num(GETPOST($qty, 'alphanohtml')); $puformove = (float) price2num(GETPOST($pu, 'alphanohtml')); - if ($qtytomove) { + if ($qtytomove != 0) { if (!(GETPOST($ent, 'int') > 0)) { dol_syslog('No dispatch for line '.$key.' as no warehouse was chosen.'); $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' '.($numline);