From 2c8d59dc4d009544cd2ea017d1631d5b4db6b7da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Aug 2023 17:05:01 +0200 Subject: [PATCH] Fix log of notification browser checks --- htdocs/core/ajax/check_notifications.php | 9 ++++----- htdocs/core/js/lib_notification.js.php | 9 +++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index 18c1a1ece79..6eb10d15e34 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -2,6 +2,7 @@ /* Copyright (C) 2016 Sergio Sanchis * Copyright (C) 2017 Juanjo Menent * Copyright (C) 2019 Frédéric France + * Copyright (C) 2023 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,10 +94,7 @@ $eventfound = array(); //Uncomment this to force a test //$eventfound[]=array('type'=>'agenda', 'id'=>1, 'tipo'=>'eee', 'location'=>'aaa'); -//dol_syslog('time='.$time.' $_SESSION[auto_ck_events_not_before]='.$_SESSION['auto_check_events_not_before']); - -// TODO Try to make a solution with only a javascript timer that is easier. Difficulty is to avoid notification twice when several tabs are opened. -// This need to extend period to be sure to not miss and save in session what we notified to avoid duplicate. +// TODO Remove use of $_SESSION['auto_check_events_not_before']. Seems not used. if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto_check_events_not_before'] || GETPOST('forcechecknow', 'int')) { /*$time_update = (int) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY; // Always defined if (!empty($_SESSION['auto_check_events_not_before'])) @@ -124,7 +122,8 @@ if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; - dol_syslog('NEW $_SESSION[auto_check_events_not_before]='.(empty($_SESSION['auto_check_events_not_before']) ? '' : $_SESSION['auto_check_events_not_before'])); + //dol_syslog('$_SESSION[auto_check_events_not_before]='.(empty($_SESSION['auto_check_events_not_before']) ? '' : $_SESSION['auto_check_events_not_before'])); + dol_syslog('dolnotif_nb_test_for_page='.GETPOST('dolnotif_nb_test_for_page')); $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'; $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index d60a0874e57..94fc9904a61 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -1,7 +1,7 @@ * Copyright (C) 2017 Juanjo Menent - * Copyright (C) 2020 Destailleur Laurent + * Copyright (C) 2020-2023 Destailleur Laurent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,11 @@ * Library javascript to enable Browser notifications */ +/** + * \file htdocs/core/js/lib_notification.js.php + * \brief Javascript code to manage browser reminers + */ + if (!defined('NOREQUIREUSER')) { define('NOREQUIREUSER', '1'); } @@ -121,7 +126,7 @@ function check_events() { $.ajax("", { type: "post", // Usually post or get async: true, - data: { time_js_next_test: time_js_next_test, forcechecknow: 1, token: currentToken }, + data: { time_js_next_test: time_js_next_test, forcechecknow: 1, token: currentToken, dolnotif_nb_test_for_page: dolnotif_nb_test_for_page }, dataType: "json", success: function (result) { //console.log(result);