diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php
index 54726aefc83..11bb1520ff0 100644
--- a/htdocs/public/agenda/agendaexport.php
+++ b/htdocs/public/agenda/agendaexport.php
@@ -95,20 +95,32 @@ if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY))
exit;
}
-// Check exportkey
-if (empty($_GET["exportkey"]) || $conf->global->MAIN_AGENDA_XCAL_EXPORTKEY != $_GET["exportkey"])
-{
- $user->getrights();
-
- llxHeaderVierge();
- print '
Bad value for key.
';
- llxFooterVierge();
- 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){
+ llxHeaderVierge();
+ if(!empty($hookmanager->errors) && is_array($hookmanager->errors)){
+ print ''.implode('
', $hookmanager->errors).'
';
+ }else{
+ print ''.$hookmanager->error.'
';
+ }
+ llxFooterVierge();
+}
+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;
+ }
+}
+
+
// Define filename with prefix on filters predica (each predica set must have on cache file)
$shortfilename='dolibarrcalendar';
$filename=$shortfilename;