diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index c1c26234206..6c1dd4ddeb2 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -200,6 +200,7 @@ if (empty($reshook)) $mesg = $object->error; } } elseif ($action == 'add' && $user->rights->ficheinter->creer) { + $selectedLines = GETPOST('toselect', 'array'); $object->socid = $socid; $object->duration = (int) GETPOST('duration', 'int'); $object->fk_project = (int) GETPOST('projectid', 'int'); @@ -284,6 +285,8 @@ if (empty($reshook)) for ($i = 0; $i < $num; $i++) { + if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines + $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : Product::TYPE_PRODUCT); if ($product_type == Product::TYPE_SERVICE || !empty($conf->global->FICHINTER_PRINT_PRODUCTS)) { //only services except if config includes products @@ -1023,8 +1026,6 @@ if ($action == 'create') print ''; print ''; - print ''; - // Show origin lines if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { $title = $langs->trans('Services'); @@ -1036,6 +1037,8 @@ if ($action == 'create') print ''; } + + print ''; } else { print '