diff --git a/view/digiriskelement/digiriskelement_informations.php b/view/digiriskelement/digiriskelement_informations.php index 81427696b..769f71124 100644 --- a/view/digiriskelement/digiriskelement_informations.php +++ b/view/digiriskelement/digiriskelement_informations.php @@ -51,6 +51,8 @@ $object = new DigiriskElement($db); $dashboard = new SaturneDashboard($db, $moduleNameLowerCase); +$upload_dir = $conf->digiriskdolibarr->multidir_output[$conf->entity ?? 1]; + $hookmanager->initHooks(['digiriskelementinformations', 'digiriskelementview', 'globalcard']); // Note that conf->hooks_modules contains array // Load object @@ -71,23 +73,8 @@ } if (empty($resHook)) { - if ($action == 'adddashboardinfo' || $action == 'closedashboardinfo') { - $data = json_decode(file_get_contents('php://input'), true); - $dashboardWidgetName = $data['dashboardWidgetName']; - $confName = $moduleNameUpperCase . '_DISABLED_DASHBOARD_INFO'; - $visible = json_decode($user->conf->$confName); - - if ($action == 'adddashboardinfo') { - unset($visible->$dashboardWidgetName); - } else { - $visible->$dashboardWidgetName = 0; - } - - $tabParam[$confName] = json_encode($visible); - - dol_set_user_param($db, $conf, $user, $tabParam); - $action = ''; - } + // Actions closenotice, adddashboardinfo, closedashboardinfo, generate_csv + require_once __DIR__ . '/../../../saturne/core/tpl/actions/dashboard_actions.tpl.php'; } /* diff --git a/view/digiriskstandard/digiriskstandard_card.php b/view/digiriskstandard/digiriskstandard_card.php index bef9d95db..eb820379b 100644 --- a/view/digiriskstandard/digiriskstandard_card.php +++ b/view/digiriskstandard/digiriskstandard_card.php @@ -59,6 +59,8 @@ $object->fetch($conf->global->DIGIRISKDOLIBARR_ACTIVE_STANDARD); +$upload_dir = $conf->digiriskdolibarr->multidir_output[$conf->entity ?? 1]; + $hookmanager->initHooks(array('digiriskelementcard', 'digiriskstandardview', 'globalcard')); // Note that conf->hooks_modules contains array // Security check - Protection if external user @@ -69,22 +71,15 @@ * Actions */ -if ($action == 'adddashboardinfo' || $action == 'closedashboardinfo') { - $data = json_decode(file_get_contents('php://input'), true); - $dashboardWidgetName = $data['dashboardWidgetName']; - $confName = $moduleNameUpperCase . '_DISABLED_DASHBOARD_INFO'; - $visible = json_decode($user->conf->$confName); - - if ($action == 'adddashboardinfo') { - unset($visible->$dashboardWidgetName); - } else { - $visible->$dashboardWidgetName = 0; - } - - $tabParam[$confName] = json_encode($visible); +$parameters = []; +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks. +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} - dol_set_user_param($db, $conf, $user, $tabParam); - $action = ''; +if (empty($reshook)) { + // Actions closenotice, adddashboardinfo, closedashboardinfo, generate_csv + require_once __DIR__ . '/../../../saturne/core/tpl/actions/dashboard_actions.tpl.php'; } /*