diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c063e636a91..e4aeae07581 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,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); @@ -2239,9 +2244,6 @@ if ($action == 'create') print ''; print ''; - print "\n"; - - // Show origin lines if (is_object($objectsrc)) { @@ -2252,10 +2254,12 @@ if ($action == 'create') print '