From af61006b8b18e2f91cf4a148029566189b23335a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Feb 2023 21:11:52 +0100 Subject: [PATCH] Add missing call of hook doActions in projet/contact.php --- htdocs/projet/contact.php | 295 +++++++++++++++++++------------------- 1 file changed, 151 insertions(+), 144 deletions(-) diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 2174a02c347..43fdb1a3ca2 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -69,134 +69,142 @@ $hookmanager->initHooks(array('projectcontactcard', 'globalcard')); * Actions */ -// Test if we can add contact to the tasks at the same times, if not or not required, make a redirect -$formconfirmtoaddtasks = ''; -if ($action == 'addcontact') { - $form = new Form($db); - - $source=GETPOST("source", 'aZ09'); - - $taskstatic = new Task($db); - $task_array = $taskstatic->getTasksArray(0, 0, $object->id, 0, 0); - $nbTasks = count($task_array); - - //If no task avaiblable, redirec to to add confirm - $type_to = (GETPOST('typecontact') ? 'typecontact='.GETPOST('typecontact') : 'type='.GETPOST('type')); - $personToAffect = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); - $affect_to = (GETPOST('userid') ? 'userid='.$personToAffect : 'contactid='.$personToAffect); - $url_redirect='?id='.$object->id.'&'.$affect_to.'&'.$type_to.'&source='.$source; - - if ($personToAffect > 0 && (empty($conf->global->PROJECT_HIDE_TASKS) || $nbTasks > 0)) { - $text = $langs->trans('AddPersonToTask'); - $textbody = $text.' ('.$langs->trans("SelectAll").')'; - $formquestion = array('text' => $textbody); - - $task_to_affect = array(); - foreach ($task_array as $task) { - $task_already_affected=false; - $personsLinked = $task->liste_contact(-1, $source); - if (!is_array($personsLinked) && count($personsLinked) < 0) { - setEventMessage($object->error, 'errors'); - } else { - foreach ($personsLinked as $person) { - if ($person['id']==$personToAffect) { - $task_already_affected = true; - break; - } - } - if (!$task_already_affected) { - $task_to_affect[$task->id] = $task->id; - } - } - } - - if (empty($task_to_affect)) { - $action = 'addcontact_confirm'; - } else { - $formcompany = new FormCompany($db); - foreach ($task_array as $task) { - $key = $task->id; - $val = $task->ref . ' '.dol_trunc($task->label); - $formquestion[] = array( - 'type' => 'other', - 'name' => 'person_'.$key.',person_role_'.$key, - 'label' => '