From 226488b7edeb0f89f1740537b1b9dd1dd0837951 Mon Sep 17 00:00:00 2001 From: jpb Date: Fri, 8 Jul 2022 12:32:17 +0200 Subject: [PATCH 1/2] rank change. if we only have one order we leave the origin rank otherwhise we pass -1 --- htdocs/core/actions_massactions.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 70b79ffbefc..56492276c73 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -604,7 +604,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders $nb_bills_created = 0; $db->begin(); - + $nbOrders = is_array($orders) ? count($orders) : 1; foreach ($orders as $id_order) { $cmd = new Commande($db); @@ -726,7 +726,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } - + $rankedLine = ($nbOrders > 1) ? -1 : $lines[$i]->rang; $result = $objecttmp->addline( $desc, $lines[$i]->subprice, @@ -744,7 +744,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders 'HT', 0, $product_type, - $lines[$i]->rang, + $rankedLine, $lines[$i]->special_code, $objecttmp->origin, $lines[$i]->rowid, From c16cd502d00b561950525206c255af6a2afe19c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 18:43:25 +0200 Subject: [PATCH 2/2] Update actions_massactions.inc.php --- htdocs/core/actions_massactions.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 56492276c73..811e9b80d44 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -604,7 +604,9 @@ if ($massaction == 'confirm_createbills') // Create bills from orders $nb_bills_created = 0; $db->begin(); - $nbOrders = is_array($orders) ? count($orders) : 1; + + $nbOrders = is_array($orders) ? count($orders) : 1; + foreach ($orders as $id_order) { $cmd = new Commande($db);