Merge pull request #21480 from atm-jpb/13.0_fix_massaction_create_invoice_on_multiorders
FIX : rank duplicate on mass action invoice from multiple orders
This commit is contained in:
commit
fcbe09b790
@ -605,6 +605,8 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
$nbOrders = is_array($orders) ? count($orders) : 1;
|
||||||
|
|
||||||
foreach ($orders as $id_order)
|
foreach ($orders as $id_order)
|
||||||
{
|
{
|
||||||
$cmd = new Commande($db);
|
$cmd = new Commande($db);
|
||||||
@ -726,7 +728,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
|
|||||||
$lines[$i]->fetch_optionals();
|
$lines[$i]->fetch_optionals();
|
||||||
$array_options = $lines[$i]->array_options;
|
$array_options = $lines[$i]->array_options;
|
||||||
}
|
}
|
||||||
|
$rankedLine = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
|
||||||
$result = $objecttmp->addline(
|
$result = $objecttmp->addline(
|
||||||
$desc,
|
$desc,
|
||||||
$lines[$i]->subprice,
|
$lines[$i]->subprice,
|
||||||
@ -744,7 +746,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
|
|||||||
'HT',
|
'HT',
|
||||||
0,
|
0,
|
||||||
$product_type,
|
$product_type,
|
||||||
$lines[$i]->rang,
|
$rankedLine,
|
||||||
$lines[$i]->special_code,
|
$lines[$i]->special_code,
|
||||||
$objecttmp->origin,
|
$objecttmp->origin,
|
||||||
$lines[$i]->rowid,
|
$lines[$i]->rowid,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user