From 5c59ddb3572dc1085ea5356e2fc5213646e9c1f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 10 Dec 2019 21:11:52 +0100 Subject: [PATCH] add hook like for per day/week/month --- htdocs/comm/action/card.php | 2 +- htdocs/comm/action/index.php | 5 +++++ htdocs/comm/action/peruser.php | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 765502075c2..19856095cd5 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -623,7 +623,7 @@ if (empty($reshook) && $action == 'update') */ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes') { - $object->fetch($id); + $object->fetch($id); $object->fetch_optionals(); $object->fetch_userassigned(); $object->oldcopy = clone $object; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 47feb0e75ae..562982dfc47 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -89,6 +89,7 @@ $pid=GETPOST("search_projectid", "int", 3)?GETPOST("search_projectid", "int", 3) $status=GETPOST("search_status", 'aZ09')?GETPOST("search_status", 'aZ09'):GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo' $type=GETPOST("search_type", 'aZ09')?GETPOST("search_type", 'aZ09'):GETPOST("type", 'aZ09'); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) if (GETPOST('search_actioncode', 'array')) { @@ -167,6 +168,10 @@ if ($action == 'delete_action') { $event = new ActionComm($db); $event->fetch($actionid); + $event->fetch_optionals(); + $event->fetch_userassigned(); + $event->oldcopy = clone $event; + $result = $event->delete(); } diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 54373fcf8a9..6a2e8167dfb 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -88,6 +88,7 @@ $pid=GETPOST("search_projectid", "int", 3)?GETPOST("search_projectid", "int", 3) $status=GETPOST("search_status", 'alpha')?GETPOST("search_status", 'alpha'):GETPOST("status", 'alpha'); $type=GETPOST("search_type", 'alpha')?GETPOST("search_type", 'alpha'):GETPOST("type", 'alpha'); $maxprint=((GETPOST("maxprint", 'int')!='')?GETPOST("maxprint", 'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) if (GETPOST('search_actioncode', 'array')) { @@ -154,6 +155,10 @@ if ($action == 'delete_action') { $event = new ActionComm($db); $event->fetch($actionid); + $event->fetch_optionals(); + $event->fetch_userassigned(); + $event->oldcopy = clone $event; + $result = $event->delete(); } @@ -162,6 +167,26 @@ if ($action == 'delete_action') /* * View */ +$parameters = array( + 'socid' => $socid, + 'status' => $status, + 'year' => $year, + 'month' => $month, + 'day' => $day, + 'type' => $type, + 'maxprint' => $maxprint, + 'filter' => $filter, + 'filtert' => $filtert, + 'showbirthday' => $showbirthday, + 'canedit' => $canedit, + 'optioncss' => $optioncss, + 'actioncode' => $actioncode, + 'pid' => $pid, + 'resourceid' => $resourceid, + 'usergroup' => $usergroup, +); +$reshook = $hookmanager->executeHooks('beforeAgendaPerUser', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $form = new Form($db); $companystatic = new Societe($db);