diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php
index cf4f3832a1f..0a43411463d 100644
--- a/htdocs/admin/agenda_other.php
+++ b/htdocs/admin/agenda_other.php
@@ -389,37 +389,6 @@ $tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->tra
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
print ''."\n";
-// AGENDA NOTIFICATION
-if ($conf->global->MAIN_FEATURES_LEVEL > 0)
-{
-
- print '
'."\n";
- print '| '.$langs->trans('AGENDA_NOTIFICATION').' | '."\n";
- print ' | '."\n";
- print ''."\n";
-
- if (empty($conf->global->AGENDA_NOTIFICATION)) {
- print ''.img_picto($langs->trans('Disabled'),'switch_off').'';
- print ' |
'."\n";
- } else {
- print ''.img_picto($langs->trans('Enabled'),'switch_on').'';
- print ''."\n";
-
- print ''."\n";
- print '| '.$langs->trans('AGENDA_NOTIFICATION_SOUND').' | '."\n";
- print ' | '."\n";
- print ''."\n";
-
- if (empty($conf->global->AGENDA_NOTIFICATION_SOUND)) {
- print ''.img_picto($langs->trans('Disabled'),'switch_off').'';
- } else {
- print ''.img_picto($langs->trans('Enabled'),'switch_on').'';
- }
-
- print ' |
'."\n";
- }
-}
-
print '';
dol_fiche_end();
diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php
new file mode 100644
index 00000000000..635f3c0cdd5
--- /dev/null
+++ b/htdocs/admin/agenda_reminder.php
@@ -0,0 +1,255 @@
+
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/admin/agenda_reminder.php
+ * \ingroup agenda
+ * \brief Page to setup agenda reminder options
+ */
+
+require '../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
+
+if (!$user->admin)
+ accessforbidden();
+
+$langs->load("admin");
+$langs->load("other");
+$langs->load("agenda");
+
+$action = GETPOST('action','alpha');
+$value = GETPOST('value','alpha');
+$param = GETPOST('param','alpha');
+$cancel = GETPOST('cancel','alpha');
+$scandir = GETPOST('scandir','alpha');
+$type = 'action';
+
+
+/*
+ * Actions
+ */
+
+include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+
+if (preg_match('/set_(.*)/',$action,$reg))
+{
+ $code=$reg[1];
+ $value=(GETPOST($code) ? GETPOST($code) : 1);
+ if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
+ {
+ Header("Location: ".$_SERVER["PHP_SELF"]);
+ exit;
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+}
+
+if (preg_match('/del_(.*)/',$action,$reg))
+{
+ $code=$reg[1];
+ if (dolibarr_del_const($db, $code, $conf->entity) > 0)
+ {
+ Header("Location: ".$_SERVER["PHP_SELF"]);
+ exit;
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+}
+if ($action == 'set')
+{
+ dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
+}
+else if ($action == 'specimen') // For orders
+{
+ $modele=GETPOST('module','alpha');
+
+ $commande = new CommandeFournisseur($db);
+ $commande->initAsSpecimen();
+ $commande->thirdparty=$specimenthirdparty;
+
+ // Search template files
+ $file=''; $classname=''; $filefound=0;
+ $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
+ foreach($dirmodels as $reldir)
+ {
+ $file=dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php",0);
+ if (file_exists($file))
+ {
+ $filefound=1;
+ $classname = "pdf_".$modele;
+ break;
+ }
+ }
+
+ if ($filefound)
+ {
+ require_once $file;
+
+ $module = new $classname($db,$commande);
+
+ if ($module->write_file($commande,$langs) > 0)
+ {
+ header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
+ return;
+ }
+ else
+ {
+ setEventMessages($module->error, $module->errors, 'errors');
+ dol_syslog($module->error, LOG_ERR);
+ }
+ }
+ else
+ {
+ setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
+ dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
+ }
+}
+
+// Activate a model
+else if ($action == 'setmodel')
+{
+ //print "sssd".$value;
+ $ret = addDocumentModel($value, $type, $label, $scandir);
+}
+
+else if ($action == 'del')
+{
+ $ret = delDocumentModel($value, $type);
+ if ($ret > 0)
+ {
+ if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF',$conf->entity);
+ }
+}
+
+// Set default model
+else if ($action == 'setdoc')
+{
+ if (dolibarr_set_const($db, "ACTION_EVENT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
+ {
+ // La constante qui a ete lue en avant du nouveau set
+ // on passe donc par une variable pour avoir un affichage coherent
+ $conf->global->ACTION_EVENT_ADDON_PDF = $value;
+ }
+
+ // On active le modele
+ $ret = delDocumentModel($value, $type);
+ if ($ret > 0)
+ {
+ $ret = addDocumentModel($value, $type, $label, $scandir);
+ }
+}
+
+
+/**
+ * View
+ */
+
+$formactions=new FormActions($db);
+$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
+llxHeader();
+
+$linkback=''.$langs->trans("BackToModuleList").'';
+print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
+print "
\n";
+
+
+
+
+$head=agenda_prepare_head();
+
+dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action');
+
+print '';
+
+print "
";
+
+llxFooter();
+
+$db->close();
diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php
index b640f4cc81b..ba725d3e226 100644
--- a/htdocs/core/js/lib_notification.js.php
+++ b/htdocs/core/js/lib_notification.js.php
@@ -90,7 +90,7 @@ if (! ($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['H
if (arr.length > 0) {
var audio = null;
global->AGENDA_NOTIFICATION_SOUND)) {
+ if (! empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) {
print 'audio = new Audio(\''.DOL_URL_ROOT.'/theme/common/sound/notification_agenda.wav'.'\');';
}
?>
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index 5ac0982a3a0..0a4ad9ffcc9 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -412,6 +412,14 @@ function agenda_prepare_head()
$head[$h][2] = 'autoactions';
$h++;
+ if ($conf->global->MAIN_FEATURES_LEVEL > 0)
+ {
+ $head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php";
+ $head[$h][1] = $langs->trans("Reminders");
+ $head[$h][2] = 'reminders';
+ $h++;
+ }
+
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php";
$head[$h][1] = $langs->trans("ExportCal");
$head[$h][2] = 'xcal';
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 22444baa18e..d386ed03614 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -526,7 +526,7 @@ Module510Name=Payment of employee wages
Module510Desc=Record and follow payment of your employee wages
Module520Name=Loan
Module520Desc=Management of loans
-Module600Name=Notifications on events
+Module600Name=Notifications on business events
Module600Desc=Send EMail notifications (triggered by some business events) to users (setup defined on each user), to third-party contacts (setup defined on each third party) or to fixed emails
Module600Long=Note that this module is dedicated to send real time emails when a dedicated business event occurs. If you are looking for a feature to send reminders by email of your agenda events, go into setup of module Agenda.
Module700Name=Donations
@@ -1516,13 +1516,14 @@ AccountancyCodeBuy=Purchase account. code
AgendaSetup=Events and agenda module setup
PasswordTogetVCalExport=Key to authorize export link
PastDelayVCalExport=Do not export event older than
-AGENDA_USE_EVENT_TYPE=Use events types (managed into menu Setup -> Dictionary -> Type of agenda events)
+AGENDA_USE_EVENT_TYPE=Use events types (managed into menu Setup -> Dictionaries -> Type of agenda events)
AGENDA_USE_EVENT_TYPE_DEFAULT=Set automatically this default value for type of event into event create form
AGENDA_DEFAULT_FILTER_TYPE=Set automatically this type of event into search filter of agenda view
AGENDA_DEFAULT_FILTER_STATUS=Set automatically this status for events into search filter of agenda view
AGENDA_DEFAULT_VIEW=Which tab do you want to open by default when selecting menu Agenda
-AGENDA_NOTIFICATION=Enable event notification on user browsers when event date is reached (each user is able to refuse this from the browser confirmation question)
-AGENDA_NOTIFICATION_SOUND=Enable sound notification
+AGENDA_REMINDER_EMAIL=Enable event reminder by emails (defined on each event). Note: Module %s must be enabled and correctly setup to have reminder sent at the correct frequency.
+AGENDA_REMINDER_BROWSER=Enable event reminder on users browser (when event date is reached, each user is able to refuse this from the browser confirmation question)
+AGENDA_REMINDER_BROWSER_SOUND=Enable sound notification
AGENDA_SHOW_LINKED_OBJECT=Show linked object into agenda view
##### Clicktodial #####
ClickToDialSetup=Click To Dial module setup
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 89b99a61041..98d89a9a692 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1311,7 +1311,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
if (! defined('DISABLE_BROWSER_NOTIF'))
{
$enablebrowsernotif=false;
- if (! empty($conf->agenda->enabled) && ! empty($conf->global->AGENDA_NOTIFICATION)) $enablebrowsernotif=true;
+ if (! empty($conf->agenda->enabled) && ! empty($conf->global->AGENDA_REMINDER_BROWSER)) $enablebrowsernotif=true;
if ($conf->browser->layout == 'phone') $enablebrowsernotif=false;
if ($enablebrowsernotif)
{