From f7430565725dbbd80ddc2bb8cc903fe96ad8639a Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 3 Sep 2019 11:15:35 +0200 Subject: [PATCH 1/2] Add missing agenda hook --- htdocs/public/agenda/agendaexport.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index a69c940f7e2..33644e7bb72 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -95,6 +95,18 @@ if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) exit; } +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks +$hookmanager->initHooks(array('agendaexport')); + +$reshook = $hookmanager->executeHooks('doActions', $filters); // Note that $action and $object may have been modified by some +if ($reshook < 0){ + if(!empty($hookmanager->errors) && is_array($hookmanager->errors)){ + print '
'.implode('
', $hookmanager->errors).'
'; + }else{ + print '
'.$hookmanager->error.'
'; + } +} + // Check exportkey if (empty($_GET["exportkey"]) || $conf->global->MAIN_AGENDA_XCAL_EXPORTKEY != $_GET["exportkey"]) { @@ -106,8 +118,6 @@ if (empty($_GET["exportkey"]) || $conf->global->MAIN_AGENDA_XCAL_EXPORTKEY != $_ exit; } -// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks -$hookmanager->initHooks(array('agendaexport')); // Define filename with prefix on filters predica (each predica set must have on cache file) $shortfilename='dolibarrcalendar'; From 42433f3beb220e7569c1a5d60741089e54305c33 Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 3 Sep 2019 11:23:27 +0200 Subject: [PATCH 2/2] Fix: hook replace behavior --- htdocs/public/agenda/agendaexport.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 33644e7bb72..dee0e8267ef 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -100,22 +100,24 @@ $hookmanager->initHooks(array('agendaexport')); $reshook = $hookmanager->executeHooks('doActions', $filters); // Note that $action and $object may have been modified by some if ($reshook < 0){ + llxHeaderVierge(); if(!empty($hookmanager->errors) && is_array($hookmanager->errors)){ print '
'.implode('
', $hookmanager->errors).'
'; }else{ print '
'.$hookmanager->error.'
'; } -} - -// Check exportkey -if (empty($_GET["exportkey"]) || $conf->global->MAIN_AGENDA_XCAL_EXPORTKEY != $_GET["exportkey"]) -{ - $user->getrights(); - - llxHeaderVierge(); - print '
Bad value for key.
'; llxFooterVierge(); - exit; +} +elseif(empty($reshook)) { + // Check exportkey + if (empty($_GET["exportkey"]) || $conf->global->MAIN_AGENDA_XCAL_EXPORTKEY != $_GET["exportkey"]) { + $user->getrights(); + + llxHeaderVierge(); + print '
Bad value for key.
'; + llxFooterVierge(); + exit; + } }