21if (!defined(
'NOTOKENRENEWAL')) {
22 define(
'NOTOKENRENEWAL',
'1');
24if (!defined(
'NOREQUIREMENU')) {
25 define(
'NOREQUIREMENU',
'1');
27if (!defined(
'NOREQUIREHTML')) {
28 define(
'NOREQUIREHTML',
'1');
30if (!defined(
'NOREQUIREAJAX')) {
31 define(
'NOREQUIREAJAX',
'1');
33if (!defined(
'NOREQUIRESOC')) {
34 define(
'NOREQUIRESOC',
'1');
36if (!defined(
'NOREQUIRETRAN')) {
37 define(
'NOREQUIRETRAN',
'1');
41require
'../../main.inc.php';
52$action =
GETPOST(
'action',
'aZ09');
55$listofreminderids =
GETPOST(
'listofreminderids',
'aZ09');
65if ($action ==
'stopreminder') {
66 dol_syslog(
"Clear notification for listofreminderids=".$listofreminderids);
67 $listofreminderid =
GETPOST(
'listofreminderids',
'intcomma');
70 $sql =
'UPDATE '.MAIN_DB_PREFIX.
'actioncomm_reminder SET status = 1';
71 $sql .=
' WHERE status = 0 AND rowid IN ('.$db->sanitize($db->escape($listofreminderid)).
')';
72 $sql .=
' AND fk_user = '.((int) $user->id).
' AND entity = '.((int)
$conf->entity);
73 $resql = $db->query($sql);
78 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
81 $sql =
'DELETE FROM '.MAIN_DB_PREFIX.
'actioncomm_reminder';
83 $sql .=
" AND fk_user = ".((int) $user->id).
' AND entity = '.((int)
$conf->entity);
84 $resql = $db->query($sql);
99global $user, $db, $langs,
$conf;
101$eventfound = array();
106if (empty($_SESSION[
'auto_check_events_not_before']) || $time >= $_SESSION[
'auto_check_events_not_before'] ||
GETPOSTINT(
'forcechecknow')) {
128 session_write_close();
130 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
136 $sql =
'SELECT a.id as id_agenda, a.code, a.datep, a.label, a.location, ar.rowid as id_reminder, ar.dateremind, ar.fk_user as id_user_reminder';
137 $sql .=
' FROM '.MAIN_DB_PREFIX.
'actioncomm as a';
138 $sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id);
139 $sql .=
" AND ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(
dol_now()).
"'";
140 $sql .=
" AND ar.status = 0";
141 $sql .=
" AND ar.entity = ".((int)
$conf->entity);
142 $sql .= $db->order(
'datep',
'ASC');
143 $sql .= $db->plimit(10);
145 $resql = $db->query($sql);
147 while ($obj = $db->fetch_object($resql)) {
150 $event[
'type'] =
'agenda';
151 $event[
'id_reminder'] = $obj->id_reminder;
152 $event[
'id_agenda'] = $obj->id_agenda;
153 $event[
'id_user'] = $obj->id_user_reminder;
154 $event[
'code'] = $obj->code;
155 $event[
'label'] = $obj->label;
156 $event[
'location'] = $obj->location;
157 $event[
'reminder_date_formated_tzserver'] =
dol_print_date($db->jdate($obj->dateremind),
'standard',
'tzserver');
158 $event[
'event_date_start_formated_tzserver'] =
dol_print_date($db->jdate($obj->datep),
'standard',
'tzserver');
159 $event[
'reminder_date_formated'] =
dol_print_date($db->jdate($obj->dateremind),
'standard',
'tzuser');
160 $event[
'event_date_start_formated'] =
dol_print_date($db->jdate($obj->datep),
'standard',
'tzuser');
162 $eventfound[$obj->id_agenda] = $event;
165 dol_syslog(
"Error sql = ".$db->lasterror(), LOG_ERR);
169print json_encode(array(
'pastreminders'=>$eventfound,
'nextreminder'=>
''));
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...