add hook like for per day/week/month

This commit is contained in:
Frédéric FRANCE 2019-12-10 21:11:52 +01:00
parent 82a92b3c08
commit 5c59ddb357
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
3 changed files with 31 additions and 1 deletions

View File

@ -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;

View File

@ -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();
}

View File

@ -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);