20 if (!defined(
'NOTOKENRENEWAL')) {
21 define(
'NOTOKENRENEWAL',
'1');
23 if (!defined(
'NOREQUIREMENU')) {
24 define(
'NOREQUIREMENU',
'1');
26 if (!defined(
'NOREQUIREHTML')) {
27 define(
'NOREQUIREHTML',
'1');
29 if (!defined(
'NOREQUIREAJAX')) {
30 define(
'NOREQUIREAJAX',
'1');
32 if (!defined(
'NOREQUIRESOC')) {
33 define(
'NOREQUIRESOC',
'1');
35 if (!defined(
'NOREQUIRETRAN')) {
36 define(
'NOREQUIRETRAN',
'1');
40 require
'../../main.inc.php';
44 $action =
GETPOST(
'action',
'aZ09');
45 $listofreminderids =
GETPOST(
'listofreminderids',
'aZ09');
55 if ($action ==
'stopreminder') {
56 dol_syslog(
"Clear notification for listofreminderids=".$listofreminderids);
57 $listofreminderid =
GETPOST(
'listofreminderids',
'intcomma');
60 $sql =
'UPDATE '.MAIN_DB_PREFIX.
'actioncomm_reminder SET status = 1';
61 $sql .=
' WHERE status = 0 AND rowid IN ('.$db->sanitize($db->escape($listofreminderid)).
')';
62 $sql .=
' AND fk_user = '.((int) $user->id).
' AND entity = '.((int) $conf->entity);
63 $resql = $db->query(
$sql);
69 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
72 $sql =
'DELETE FROM '.MAIN_DB_PREFIX.
'actioncomm_reminder';
74 $sql .=
" AND fk_user = ".((int) $user->id).
' AND entity = '.((int) $conf->entity);
75 $resql = $db->query(
$sql);
90 global $user, $db, $langs, $conf;
92 $eventfound = array();
100 if (empty($_SESSION[
'auto_check_events_not_before']) || $time >= $_SESSION[
'auto_check_events_not_before'] ||
GETPOST(
'forcechecknow',
'int')) {
122 session_write_close();
124 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
127 dol_syslog(
'NEW $_SESSION[auto_check_events_not_before]='.(empty($_SESSION[
'auto_check_events_not_before']) ?
'' : $_SESSION[
'auto_check_events_not_before']));
129 $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';
130 $sql .=
' FROM '.MAIN_DB_PREFIX.
'actioncomm as a';
131 $sql .=
' INNER JOIN '.MAIN_DB_PREFIX.
'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id);
132 $sql .=
" AND ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(
dol_now()).
"' AND ar.status = 0 AND ar.entity = ".((
int) $conf->entity);
133 $sql .= $db->order(
'datep',
'ASC');
134 $sql .= $db->plimit(10);
136 $resql = $db->query(
$sql);
138 while ($obj = $db->fetch_object($resql)) {
141 $event[
'type'] =
'agenda';
142 $event[
'id_reminder'] = $obj->id_reminder;
143 $event[
'id_agenda'] = $obj->id_agenda;
144 $event[
'id_user'] = $obj->id_user_reminder;
145 $event[
'code'] = $obj->code;
146 $event[
'label'] = $obj->label;
147 $event[
'location'] = $obj->location;
148 $event[
'reminder_date_formated_tzserver'] =
dol_print_date($db->jdate($obj->dateremind),
'standard',
'tzserver');
149 $event[
'event_date_start_formated_tzserver'] =
dol_print_date($db->jdate($obj->datep),
'standard',
'tzserver');
150 $event[
'reminder_date_formated'] =
dol_print_date($db->jdate($obj->dateremind),
'standard',
'tzuser');
151 $event[
'event_date_start_formated'] =
dol_print_date($db->jdate($obj->datep),
'standard',
'tzuser');
153 $eventfound[$obj->id_agenda] = $event;
156 dol_syslog(
"Error sql = ".$db->lasterror(), LOG_ERR);
160 print json_encode(array(
'pastreminders'=>$eventfound,
'nextreminder'=>
''));
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.