From 3de0a682c1386e9e20cc317222c3fd67710d645f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 18 Apr 2023 16:31:58 +0200 Subject: [PATCH 1/3] FIX for empty shipping --- htdocs/expedition/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index e2220ec6367..3286f97002e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -317,7 +317,7 @@ if (empty($reshook)) { //var_dump($batch_line[2]); - if ($totalqty > 0) { // There is at least one thing to ship + if ($totalqty > 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { // There is at least one thing to ship //var_dump($_POST);exit; for ($i = 0; $i < $num; $i++) { $qty = "qtyl".$i; @@ -327,7 +327,7 @@ if (empty($reshook)) { //shipment from multiple stock locations $nbstockline = count($stockLine[$i]); for ($j = 0; $j < $nbstockline; $j++) { - if ($stockLine[$i][$j]['qty'] > 0) { + if ($stockLine[$i][$j]['qty'] > 0 || ($stockLine[$i][$j]['qty'] == 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))) { $ret = $object->addline($stockLine[$i][$j]['warehouse_id'], $stockLine[$i][$j]['ix_l'], $stockLine[$i][$j]['qty'], $array_options[$i]); if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -336,7 +336,7 @@ if (empty($reshook)) { } } } else { - if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { + if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))) { $ent = "entl".$i; $idl = "idl".$i; $entrepot_id = is_numeric(GETPOST($ent, 'int')) ?GETPOST($ent, 'int') : GETPOST('entrepot_id', 'int'); From d7436d5d8c0d4629393746b7f906e91e3b2fd537 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 18 Apr 2023 16:38:13 +0200 Subject: [PATCH 2/3] fix test --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3286f97002e..6dbcc538397 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -317,7 +317,7 @@ if (empty($reshook)) { //var_dump($batch_line[2]); - if ($totalqty > 0 && !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { // There is at least one thing to ship + if ($totalqty > 0 || !empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { // There is at least one thing to ship //var_dump($_POST);exit; for ($i = 0; $i < $num; $i++) { $qty = "qtyl".$i; From 5ec6b2934511ff3fffba9efdcf3ea3af23a58edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alo=C3=AFs=20Micard?= Date: Sun, 23 Apr 2023 14:01:52 +0200 Subject: [PATCH 3/3] Fix order line origin/origin_id when creating from proposal --- htdocs/commande/class/commande.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c636b4e905d..5c38cbdf51d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1325,6 +1325,9 @@ class Commande extends CommonOrder $line->marge_tx = $marginInfos[1]; $line->marque_tx = $marginInfos[2]; + $line->origin = $object->element; + $line->origin_id = $object->lines[$i]->id; + // get extrafields from original line $object->lines[$i]->fetch_optionals(); foreach ($object->lines[$i]->array_options as $options_key => $value) {