From ea524033391c5fedc3021ddf3ba21df36d8db5dd Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 7 Jul 2022 11:08:01 +0200 Subject: [PATCH] rank change. if we only have one order we leave the origin rank otherwise we leave the -1 and let the class set the max rank. --- 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 af0ad2a2eaa..2bebd1ada00 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -641,7 +641,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $lastref = ''; $db->begin(); - + $nbOrders = is_array($orders) ? count($orders) : 1; foreach ($orders as $id_order) { $cmd = new Commande($db); if ($cmd->fetch($id_order) <= 0) { @@ -773,7 +773,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. } $objecttmp->context['createfromclone']; - + $rankedLine = ($nbOrders > 1) ? -1 : $lines[$i]->rang; $result = $objecttmp->addline( $desc, $lines[$i]->subprice, @@ -793,7 +793,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $product_type, //we have define the max rank for each line which makes it possible not to have a duplicate on the rank field in the case of several orders //-1 will give us the right number - -1, // rank + $rankedLine, // rank $lines[$i]->special_code, $objecttmp->origin, $lines[$i]->rowid,