diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php
index 7dfbeff82f6..3572ad47d63 100644
--- a/htdocs/admin/agenda_reminder.php
+++ b/htdocs/admin/agenda_reminder.php
@@ -25,6 +25,7 @@ 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';
+require_once DOL_DOCUMENT_ROOT.'/cron/class/cronjob.class.php';
if (!$user->admin)
accessforbidden();
@@ -218,10 +219,18 @@ if (empty($conf->cron->enabled)) {
if (empty($conf->global->AGENDA_REMINDER_EMAIL)) {
print ''.img_picto($langs->trans('Disabled'), 'switch_off').'';
} else {
- print ''.img_picto($langs->trans('Enabled'), 'switch_on').'';
// Get the max frequency of reminder
-
- print '
'.$langs->trans("AGENDA_REMINDER_EMAIL_NOTE", $langs->transnoentitiesnoconv("Module2300Name")).'';
+ // TODO Read frequency of the job sendEmailsReminder and if job is enabled
+ $job = new Cronjob($db);
+ $job->fetch(0, 'ActionComm', 'sendEmailsReminder');
+ if ($job->id > 0) {
+ if ($job->status != $job::STATUS_ENABLED) {
+ print ''.$langs->trans("JobXMustBeEnabled", $langs->transnoentitiesnoconv("sendEmailsReminder")).'';
+ } else {
+ print ''.img_picto($langs->trans('Enabled'), 'switch_on').'';
+ print '
'.$langs->trans("AGENDA_REMINDER_EMAIL_NOTE", $langs->transnoentitiesnoconv("sendEmailsReminder")).'';
+ }
+ }
}
}
print ''."\n";
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 5e7ddbd38fc..2333b5fb5f1 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -1625,7 +1625,7 @@ function pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails = 0)
{
if (empty($hidedetails) || $hidedetails > 1)
{
- $subprice = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_subprice : $object->lines[$i]->subprice);
+ $subprice = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_subprice : $object->lines[$i]->subprice);
$result .= price($sign * $subprice, 0, $outputlangs);
}
}
diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php
index 72ebb06e311..9484c6a2331 100644
--- a/htdocs/cron/class/cronjob.class.php
+++ b/htdocs/cron/class/cronjob.class.php
@@ -289,10 +289,12 @@ class Cronjob extends CommonObject
/**
* Load object in memory from the database
*
- * @param int $id Id object
- * @return int <0 if KO, >0 if OK
+ * @param int $id Id object
+ * @param string $objectname Object name
+ * @param string $methodname Method name
+ * @return int <0 if KO, >0 if OK
*/
- public function fetch($id)
+ public function fetch($id, $objectname = '', $methodname = '')
{
$sql = "SELECT";
$sql .= " t.rowid,";
@@ -328,7 +330,13 @@ class Cronjob extends CommonObject
$sql .= " t.libname,";
$sql .= " t.test";
$sql .= " FROM ".MAIN_DB_PREFIX."cronjob as t";
- $sql .= " WHERE t.rowid = ".$id;
+ if ($id > 0) {
+ $sql .= " WHERE t.rowid = ".$id;
+ } else {
+ $sql .= " WHERE t.entity IN(0, ".getEntity('cron').")";
+ $sql .= " AND t.objectname = '".$this->db->escape($objectname)."'";
+ $sql .= " AND t.methodename = '".$this->db->escape($methodname)."'";
+ }
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -1233,7 +1241,7 @@ class Cronjob extends CommonObject
if (($this->maxrun > 0 && ($this->nbrun >= $this->maxrun))
|| ($this->dateend && ($this->datenextrun > $this->dateend)))
{
- $this->status = 2;
+ $this->status = self::STATUS_ARCHIVED;
dol_syslog(get_class($this)."::reprogram_jobs Job will be set to archived", LOG_ERR);
}
}
diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php
index b80f67b25bd..d3f84de6bd2 100644
--- a/htdocs/cron/list.php
+++ b/htdocs/cron/list.php
@@ -602,11 +602,6 @@ if ($mode == 'modulesetup') {
}
-print '
';
-
-
-dol_print_cron_urls();
-
llxFooter();
$db->close();
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index bcd038334ba..7534ba46123 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1741,7 +1741,7 @@ AGENDA_DEFAULT_VIEW=Which view do you want to open by default when selecting men
AGENDA_REMINDER_BROWSER=Enable event reminder on user's browser (When remind date is reached, a popup is shown by the browser. Each user can disable such notifications from its browser notification setup).
AGENDA_REMINDER_BROWSER_SOUND=Enable sound notification
AGENDA_REMINDER_EMAIL=Enable event reminder by emails (remind option/delay can be defined on each event).
-AGENDA_REMINDER_EMAIL_NOTE=Note: Module %s must be enabled and correctly setup to have reminder sent at the correct frequency.
+AGENDA_REMINDER_EMAIL_NOTE=The frequency of the task %s must be enough to be sure that the remind are sent at the correct moment.
AGENDA_SHOW_LINKED_OBJECT=Show linked object into agenda view
##### Clicktodial #####
ClickToDialSetup=Click To Dial module setup
diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang
index 753b37da438..9bf918a73a3 100644
--- a/htdocs/langs/en_US/cron.lang
+++ b/htdocs/langs/en_US/cron.lang
@@ -84,3 +84,4 @@ MakeLocalDatabaseDumpShort=Local database backup
MakeLocalDatabaseDump=Create a local database dump. Parameters are: compression ('gz' or 'bz' or 'none'), backup type ('mysql', 'pgsql', 'auto'), 1, 'auto' or filename to build, number of backup files to keep
WarningCronDelayed=Attention, for performance purpose, whatever is next date of execution of enabled jobs, your jobs may be delayed to a maximum of %s hours, before being run.
DATAPOLICYJob=Data cleaner and anonymizer
+JobXMustBeEnabled=Job %s must be enabled
\ No newline at end of file