diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 530a0d22766..61550e750e3 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -646,6 +646,7 @@ if (empty($reshook)) elseif ($action == 'add' && $usercancreate) { if ($socid > 0) $object->socid = GETPOST('socid', 'int'); + $selectedLines = GETPOST('toselect', 'array'); $db->begin(); @@ -961,6 +962,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); @@ -2192,9 +2197,6 @@ if ($action == 'create') print ''; print ''; - print "\n"; - - // Show origin lines if (is_object($objectsrc)) { print '
'; @@ -2204,10 +2206,12 @@ if ($action == 'create') print ''; - $objectsrc->printOriginLinesList(); + $objectsrc->printOriginLinesList('', $selectedLines); print '
'; } + + print "\n"; } else { if ($id > 0 || !empty($ref)) { /* *************************************************************************** */