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';
44$action =
GETPOST(
'action',
'aZ09');
47$listofreminderids =
GETPOST(
'listofreminderids',
'aZ09');
57if ($action ==
'stopreminder') {
58 dol_syslog(
"Clear notification for listofreminderids=".$listofreminderids);
59 $listofreminderid =
GETPOST(
'listofreminderids',
'intcomma');
62 $sql =
'UPDATE '.MAIN_DB_PREFIX.
'actioncomm_reminder SET status = 1';
63 $sql .=
' WHERE status = 0 AND rowid IN ('.$db->sanitize($db->escape($listofreminderid)).
')';
64 $sql .=
' AND fk_user = '.((int) $user->id).
' AND entity = '.((int) $conf->entity);
65 $resql = $db->query($sql);
70 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
73 $sql =
'DELETE FROM '.MAIN_DB_PREFIX.
'actioncomm_reminder';
75 $sql .=
" AND fk_user = ".((int) $user->id).
' AND entity = '.((int) $conf->entity);
76 $resql = $db->query($sql);
91global $user, $db, $langs, $conf;
98if (empty($_SESSION[
'auto_check_events_not_before']) || $time >= $_SESSION[
'auto_check_events_not_before'] ||
GETPOSTINT(
'forcechecknow')) {
120 session_write_close();
122 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
128 $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';
129 $sql .=
' FROM '.MAIN_DB_PREFIX.
'actioncomm as a';
130 $sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id);
131 $sql .=
" AND ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(
dol_now()).
"'";
132 $sql .=
" AND ar.status = 0";
133 $sql .=
" AND ar.entity = ".((int) $conf->entity);
134 $sql .= $db->order(
'datep',
'ASC');
135 $sql .= $db->plimit(10);
137 $resql = $db->query($sql);
139 while ($obj = $db->fetch_object($resql)) {
142 $event[
'type'] =
'agenda';
143 $event[
'id_reminder'] = $obj->id_reminder;
144 $event[
'id_agenda'] = $obj->id_agenda;
145 $event[
'id_user'] = $obj->id_user_reminder;
146 $event[
'code'] = $obj->code;
147 $event[
'label'] = $obj->label;
148 $event[
'location'] = $obj->location;
149 $event[
'reminder_date_formated_tzserver'] =
dol_print_date($db->jdate($obj->dateremind),
'standard',
'tzserver');
150 $event[
'event_date_start_formated_tzserver'] =
dol_print_date($db->jdate($obj->datep),
'standard',
'tzserver');
151 $event[
'reminder_date_formated'] =
dol_print_date($db->jdate($obj->dateremind),
'standard',
'tzuser');
152 $event[
'event_date_start_formated'] =
dol_print_date($db->jdate($obj->datep),
'standard',
'tzuser');
154 $eventfound[$obj->id_agenda] = $event;
157 dol_syslog(
"Error sql = ".$db->lasterror(), LOG_ERR);
161print 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.