Merge pull request #16171 from OPEN-DSI/new-ficheinter-create-from-origin-choose-lines

NEW choose lines while creating intervention card from origin
This commit is contained in:
Laurent Destailleur 2021-02-09 13:38:48 +01:00 committed by GitHub
commit 71f64c285f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 '<input type="button" class="button button-cancel" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
print '</div>';
print '</form>';
// Show origin lines
if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
$title = $langs->trans('Services');
@ -1036,6 +1037,8 @@ if ($action == 'create')
print '</table>';
}
print '</form>';
} else {
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';