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)) {
//