20 if (!defined(
'NOCSRFCHECK')) {
21 define(
'NOCSRFCHECK',
'1');
23 if (!defined(
'NOTOKENRENEWAL')) {
24 define(
'NOTOKENRENEWAL',
'1');
26 if (!defined(
'NOREQUIREMENU')) {
27 define(
'NOREQUIREMENU',
'1');
29 if (!defined(
'NOREQUIREHTML')) {
30 define(
'NOREQUIREHTML',
'1');
32 if (!defined(
'NOREQUIREAJAX')) {
33 define(
'NOREQUIREAJAX',
'1');
35 if (!defined(
'NOREQUIRESOC')) {
36 define(
'NOREQUIRESOC',
'1');
38 if (!defined(
'NOREQUIRETRAN')) {
39 define(
'NOREQUIRETRAN',
'1');
61 require
'../../main.inc.php';
65 $action =
GETPOST(
'action',
'aZ09');
66 $listofreminderids =
GETPOST(
'listofreminderids',
'aZ09');
73 if ($action ==
'stopreminder') {
74 dol_syslog(
"Clear notification for listofreminderids=".$listofreminderids);
75 $listofreminderid =
GETPOST(
'listofreminderids',
'intcomma');
78 $sql =
'UPDATE '.MAIN_DB_PREFIX.
'actioncomm_reminder SET status = 1';
79 $sql .=
' WHERE status = 0 AND rowid IN ('.$db->sanitize($db->escape($listofreminderid)).
')';
80 $sql .=
' AND fk_user = '.((int) $user->id).
' AND entity = '.((int) $conf->entity);
87 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
90 $sql =
'DELETE FROM '.MAIN_DB_PREFIX.
'actioncomm_reminder';
107 global $user, $db, $langs, $conf;
109 $eventfound = array();
117 if (empty($_SESSION[
'auto_check_events_not_before']) || $time >= $_SESSION[
'auto_check_events_not_before'] ||
GETPOST(
'forcechecknow',
'int')) {
139 session_write_close();
141 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
144 dol_syslog(
'NEW $_SESSION[auto_check_events_not_before]='.(empty($_SESSION[
'auto_check_events_not_before']) ?
'' : $_SESSION[
'auto_check_events_not_before']));
146 $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';
147 $sql .=
' FROM '.MAIN_DB_PREFIX.
'actioncomm as a';
148 if (!empty($user->conf->MAIN_USER_WANT_ALL_EVENTS_NOTIFICATIONS)) {
149 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id);
150 $sql .=
' WHERE a.code <> "AC_OTH_AUTO"';
152 $sql .=
" (ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(
dol_now()).
"' AND ar.status = 0 AND ar.entity = ".$conf->entity;
155 $sql .=
' JOIN '.MAIN_DB_PREFIX.
'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id);
156 $sql .=
" AND ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(
dol_now()).
"' AND ar.status = 0 AND ar.entity = ".$conf->entity;
158 $sql .= $db->order(
'datep',
'ASC');
161 $resql = $db->query($sql);
163 while ($obj = $db->fetch_object(
$resql)) {
166 $event[
'type'] =
'agenda';
167 $event[
'id_reminder'] = $obj->id_reminder;
168 $event[
'id_agenda'] = $obj->id_agenda;
169 $event[
'id_user'] = $obj->id_user_reminder;
170 $event[
'code'] = $obj->code;
171 $event[
'label'] = $obj->label;
172 $event[
'location'] = $obj->location;
173 $event[
'reminder_date_formated_tzserver'] =
dol_print_date($db->jdate($obj->dateremind),
'standard',
'tzserver');
174 $event[
'event_date_start_formated_tzserver'] =
dol_print_date($db->jdate($obj->datep),
'standard',
'tzserver');
175 $event[
'reminder_date_formated'] =
dol_print_date($db->jdate($obj->dateremind),
'standard',
'tzuser');
176 $event[
'event_date_start_formated'] =
dol_print_date($db->jdate($obj->datep),
'standard',
'tzuser');
178 $eventfound[$obj->id_agenda] = $event;
181 dol_syslog(
"Error sql = ".$db->lasterror(), LOG_ERR);
185 print json_encode(array(
'pastreminders'=>$eventfound,
'nextreminder'=>
''));
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_now($mode= 'auto')
Return date for now.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...