Add missing call of hook doActions in projet/contact.php

This commit is contained in:
Laurent Destailleur 2023-02-02 21:11:52 +01:00
parent e9c43718ba
commit af61006b8b

View File

@ -69,9 +69,16 @@ $hookmanager->initHooks(array('projectcontactcard', 'globalcard'));
* Actions * Actions
*/ */
// Test if we can add contact to the tasks at the same times, if not or not required, make a redirect $parameters = array('id'=>$id);
$formconfirmtoaddtasks = ''; $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
if ($action == 'addcontact') { if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
// 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); $form = new Form($db);
$source=GETPOST("source", 'aZ09'); $source=GETPOST("source", 'aZ09');
@ -147,10 +154,10 @@ if ($action == 'addcontact') {
} else { } else {
$action = 'addcontact_confirm'; $action = 'addcontact_confirm';
} }
} }
// Add new contact // Add new contact
if ($action == 'addcontact_confirm' && $user->rights->projet->creer) { if ($action == 'addcontact_confirm' && $user->rights->projet->creer) {
$contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); $contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
@ -210,19 +217,19 @@ if ($action == 'addcontact_confirm' && $user->rights->projet->creer) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
} }
// Change contact's status // Change contact's status
if ($action == 'swapstatut' && $user->rights->projet->creer) { if ($action == 'swapstatut' && $user->rights->projet->creer) {
if ($object->fetch($id)) { if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne', 'int')); $result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} }
// Delete a contact // Delete a contact
if (($action == 'deleteline' || $action == 'deletecontact') && $user->rights->projet->creer) { if (($action == 'deleteline' || $action == 'deletecontact') && $user->rights->projet->creer) {
$object->fetch($id); $object->fetch($id);
$result = $object->delete_contact(GETPOST("lineid", 'int')); $result = $object->delete_contact(GETPOST("lineid", 'int'));
@ -232,10 +239,10 @@ if (($action == 'deleteline' || $action == 'deletecontact') && $user->rights->pr
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
}
} }
/* /*
* View * View
*/ */