From d0508d557b92468b694f89fa1dec88bda9c8f9b6 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 30 Sep 2021 14:56:02 +0200 Subject: [PATCH 1/3] fix: checkbox for line selection between supplier order and supplier invoice was infective --- htdocs/fourn/facture/card.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c063e636a91..690c232cb64 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -668,6 +668,7 @@ if (empty($reshook)) elseif ($action == 'add' && $usercancreate) { if ($socid > 0) $object->socid = GETPOST('socid', 'int'); + $selectedLines = GETPOST('toselect', 'array'); $db->begin(); @@ -980,6 +981,8 @@ 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); @@ -2239,9 +2242,6 @@ if ($action == 'create') print ''; print ''; - print "\n"; - - // Show origin lines if (is_object($objectsrc)) { @@ -2256,6 +2256,8 @@ if ($action == 'create') print ''; } + + print "\n"; } else { From 6d00097c896ac40360dd0186949184f2ea8ed095 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 30 Sep 2021 16:37:52 +0200 Subject: [PATCH 2/3] fix --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 690c232cb64..778c1db1aaf 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2252,7 +2252,7 @@ if ($action == 'create') print ''; - $objectsrc->printOriginLinesList(); + $objectsrc->printOriginLinesList('', $selectedLines); print '
'; } From 10f0434116ee3898a8e6b41cdb8f8f4c0958ae37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Oct 2021 15:30:19 +0200 Subject: [PATCH 3/3] Update card.php --- htdocs/fourn/facture/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 778c1db1aaf..e4aeae07581 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -981,8 +981,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 - + 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);