diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 044cf9908ea..98fe5299a5e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -57,6 +58,7 @@ $backtopage=GETPOST('backtopage','alpha'); $contactid=GETPOST('contactid','int'); $origin=GETPOST('origin','alpha'); $originid=GETPOST('originid','int'); +$confirm = GETPOST('confirm', 'alpha'); $fulldayevent=GETPOST('fullday'); $datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); @@ -78,6 +80,10 @@ $contact = new Contact($db); $extrafields = new ExtraFields($db); $formfile = new FormFile($db); +$form = new Form($db); +$formfile = new FormFile($db); +$formactions = new FormActions($db); + // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); @@ -129,6 +135,29 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser')) if ($action == 'update') $action = 'edit'; } +// Action clone object +if ($action == 'confirm_clone' && $confirm == 'yes') +{ + if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + { + setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); + } + else + { + if ($id > 0) { + $object->fetch($id); + $result = $object->createFromClone(GETPOST('fk_userowner'), GETPOST('socid')); + if ($result > 0) { + header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); + exit(); + } else { + setEventMessage($object->error, 'errors'); + $action = ''; + } + } + } +} + // Add event if ($action == 'add') { @@ -542,10 +571,6 @@ if ($action == 'mupdate') $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('',$langs->trans("Agenda"),$help_url); -$form = new Form($db); -$formfile = new FormFile($db); -$formactions = new FormActions($db); - if ($action == 'create') { $contact = new Contact($db); @@ -1035,6 +1060,15 @@ if ($id > 0) { dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action'); + + // Clone event + if($action == 'clone') + { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . GETPOST('id'), $langs->trans('CloneAction'), $langs->trans('ConfirmCloneAction', $object->label), 'confirm_clone', $formquestion, 'yes', 1); + + print $formconfirm; + } + // Affichage fiche action en mode visu print '