From 991a7ffd43d169cfb42becd0400b92a7867b6e7e Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 21 Sep 2021 11:04:59 +0200 Subject: [PATCH] FIX selected lines on supplier invoice create --- htdocs/fourn/facture/card.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 42e2f528bc6..db1497f5166 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -680,6 +680,7 @@ if (empty($reshook)) { if ($socid > 0) { $object->socid = GETPOST('socid', 'int'); } + $selectedLines = GETPOST('toselect', 'array'); $db->begin(); @@ -1112,6 +1113,10 @@ if (empty($reshook)) { $num = count($lines); for ($i = 0; $i < $num; $i++) { // TODO handle subprice < 0 + if (!in_array($lines[$i]->id, $selectedLines)) { + continue; // Skip unselected lines + } + $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle); $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); @@ -2348,9 +2353,6 @@ if ($action == 'create') { print ''; print ''; - print "\n"; - - // Show origin lines if (is_object($objectsrc)) { print '
'; @@ -2364,6 +2366,8 @@ if ($action == 'create') { print ''; } + + print "\n"; } else { if ($id > 0 || !empty($ref)) { //