Fix warning.

Module cron is more clear.
This commit is contained in:
Laurent Destailleur 2020-11-21 16:27:50 +01:00
parent 3534555909
commit 95b79094df
6 changed files with 28 additions and 15 deletions

View File

@ -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 '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_EMAIL&amp;token='.newToken().'">'.img_picto($langs->trans('Disabled'), 'switch_off').'</a>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_EMAIL&amp;token='.newToken().'">'.img_picto($langs->trans('Enabled'), 'switch_on').'</a>';
// Get the max frequency of reminder
print '<br><span class="opacitymedium">'.$langs->trans("AGENDA_REMINDER_EMAIL_NOTE", $langs->transnoentitiesnoconv("Module2300Name")).'</span>';
// 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 '<span class="opacitymedium warning">'.$langs->trans("JobXMustBeEnabled", $langs->transnoentitiesnoconv("sendEmailsReminder")).'</span>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_EMAIL&amp;token='.newToken().'">'.img_picto($langs->trans('Enabled'), 'switch_on').'</a>';
print '<br><span class="opacitymedium">'.$langs->trans("AGENDA_REMINDER_EMAIL_NOTE", $langs->transnoentitiesnoconv("sendEmailsReminder")).'</span>';
}
}
}
}
print '</td></tr>'."\n";

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -602,11 +602,6 @@ if ($mode == 'modulesetup') {
}
print '<br><br>';
dol_print_cron_urls();
llxFooter();
$db->close();

View File

@ -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 <b>on user's browser</b> (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 <b>by emails</b> (remind option/delay can be defined on each event).
AGENDA_REMINDER_EMAIL_NOTE=Note: Module <strong>%s</strong> 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

View File

@ -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