diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php
index d076fcf7e26..c5fc1c55793 100644
--- a/htdocs/admin/agenda.php
+++ b/htdocs/admin/agenda.php
@@ -144,7 +144,7 @@ print '';
$head=agenda_prepare_head();
-dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"), 0, 'action');
+dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"), -1, 'action');
print $langs->trans("AgendaAutoActionDesc")."
\n";
print $langs->trans("OnlyActiveElementsAreShown").'
';
diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php
index 2cf3a323c21..74ae6cb2d95 100644
--- a/htdocs/admin/agenda_extrafields.php
+++ b/htdocs/admin/agenda_extrafields.php
@@ -75,7 +75,7 @@ print "
\n";
$head=agenda_prepare_head();
-dol_fiche_head($head, 'attributes', $langs->trans("Agenda"), 0, 'action');
+dol_fiche_head($head, 'attributes', $langs->trans("Agenda"), -1, 'action');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php
index 1e595b5088e..0b69b947a38 100644
--- a/htdocs/admin/agenda_extsites.php
+++ b/htdocs/admin/agenda_extsites.php
@@ -137,7 +137,7 @@ print '';
$head=agenda_prepare_head();
-dol_fiche_head($head, 'extsites', $langs->trans("Agenda"), 0, 'action');
+dol_fiche_head($head, 'extsites', $langs->trans("Agenda"), -1, 'action');
print $langs->trans("AgendaExtSitesDesc")."
\n";
print "
\n";
diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php
index 6e0a62610aa..f652829a80c 100644
--- a/htdocs/admin/agenda_other.php
+++ b/htdocs/admin/agenda_other.php
@@ -196,7 +196,7 @@ print "
\n";
$head=agenda_prepare_head();
-dol_fiche_head($head, 'other', $langs->trans("Agenda"), 0, 'action');
+dol_fiche_head($head, 'other', $langs->trans("Agenda"), -1, 'action');
/*
diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php
index cd2406e6fdc..0e66125ba7c 100644
--- a/htdocs/admin/agenda_xcal.php
+++ b/htdocs/admin/agenda_xcal.php
@@ -83,7 +83,7 @@ print '';
$head=agenda_prepare_head();
-dol_fiche_head($head, 'xcal', $langs->trans("Agenda"), 0, 'action');
+dol_fiche_head($head, 'xcal', $langs->trans("Agenda"), -1, 'action');
print $langs->trans("AgendaSetupOtherDesc")."
\n";
print "
\n";
diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php
index 4db67aef939..fa3edd7a4be 100644
--- a/htdocs/core/ajax/check_notifications.php
+++ b/htdocs/core/ajax/check_notifications.php
@@ -21,7 +21,6 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
-if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
require '../../main.inc.php';
@@ -88,9 +87,11 @@ if ($time >= $_SESSION['auto_check_events_not_before'])
while ($obj = $db->fetch_object($resql))
{
$langs->load("agenda");
+ $langs->load("commercial");
$actionmod->fetch($obj->id);
+ // Message must be formated and translated to be used with javascript directly
$event = array();
$event['type'] = 'agenda';
$event['id'] = $actionmod->id;
@@ -101,6 +102,10 @@ if ($time >= $_SESSION['auto_check_events_not_before'])
$eventfound[] = $event;
}
}
+ else
+ {
+ dol_syslog("Error sql = ".$db->lasterror(), LOG_ERR);
+ }
}
diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php
index af4452dfb39..a3b90a35db6 100644
--- a/htdocs/core/js/lib_notification.js.php
+++ b/htdocs/core/js/lib_notification.js.php
@@ -65,7 +65,7 @@ if (! ($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['H
// We set a delay before launching first test so next check will arrive after the time_auto_update compared to previous one.
var time_first_execution = (time_auto_update - (nowtime - time_js_next_test)) * 1000; //need milliseconds
if (login != '') {
- console.log("Launch browser notif check: setTimeout to wait time_first_execution="+time_first_execution+" before first check - nowtime = "+nowtime+" auto_check_events_not_before = "+auto_check_events_not_before+" time_js_next_test = "+time_js_next_test+" time_auto_update="+time_auto_update);
+ console.log("Launch browser notif check: setTimeout is set to launch 'first_execution' function after a wait of time_first_execution="+time_first_execution+". nowtime (time php page generation) = "+nowtime+" auto_check_events_not_before (val in session)= "+auto_check_events_not_before+" time_js_next_test (max now,auto_check_events_not_before) = "+time_js_next_test+" time_auto_update="+time_auto_update);
setTimeout(first_execution, time_first_execution);
} //first run auto check
@@ -79,17 +79,18 @@ if (! ($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['H
function check_events() {
if (Notification.permission === "granted")
{
- console.log("Call check_events time_js_next_test="+time_js_next_test);
- $.ajax("", {
- type: "post", // Usually post o get
+ console.log("Call check_events time_js_next_test = date we are looking for event after ="+time_js_next_test);
+ $.ajax("", {
+ type: "post", // Usually post or get
async: true,
data: {time: time_js_next_test},
success: function (result) {
var arr = JSON.parse(result);
if (arr.length > 0) {
+ var audio = null;
global->AGENDA_NOTIFICATION_SOUND)) {
- print 'var audio = new Audio(\''.DOL_URL_ROOT.'/theme/common/sound/notification_agenda.wav'.'\');';
+ print 'audio = new Audio(\''.DOL_URL_ROOT.'/theme/common/sound/notification_agenda.wav'.'\');';
}
?>
@@ -136,6 +137,7 @@ if (! ($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['H
}
time_js_next_test += time_auto_update;
+ console.log('Updated time_js_next_test. New value is '+time_js_next_test);
}