From 1017fad75406340c08cae59dbc835d9d62034640 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 22 Dec 2020 16:07:07 +0100 Subject: [PATCH] NEW add form confirm hook on company card --- htdocs/societe/card.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 0fc33232c5d..486e68f4d83 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2222,10 +2222,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print dol_get_fiche_head($head, 'card', $langs->trans("ThirdParty"), -1, 'company'); + $formconfirm = ''; + // Confirm delete third party if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) { - print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "action-delete"); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "action-delete"); } if ($action == 'merge') @@ -2239,9 +2241,18 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) ) ); - print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 250); + $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 250); } + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; + + // Print form confirm + print $formconfirm; + dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error'); $linkback = ''.$langs->trans("BackToList").'';