mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 11:31:26 +01:00
Start to introduce cron for email reminder.
This commit is contained in:
@@ -1498,5 +1498,22 @@ class ActionComm extends CommonObject
|
||||
return $this->datep && ($this->datep < ($now - $conf->agenda->warning_delay));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send reminders by emails
|
||||
* CAN BE A CRON TASK
|
||||
*
|
||||
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
public function sendEmailsReminder()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,13 @@ class modAgenda extends DolibarrModules
|
||||
//------
|
||||
$this->boxes = array(0=>array('file'=>'box_actions.php','enabledbydefaulton'=>'Home'));
|
||||
|
||||
// Cronjobs
|
||||
//------------
|
||||
$this->cronjobs = array(
|
||||
0=>array('label'=>'SendEmailsReminders', 'jobtype'=>'method', 'class'=>'comm/action/class/actioncomm.class.php', 'objectname'=>'ActionComm', 'method'=>'sendEmailsReminder', 'parameters'=>'', 'comment'=>'SendEMailsReminder', 'frequency'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'$conf->global->MAIN_FEATURES_LEVEL > 0'),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
|
||||
);
|
||||
|
||||
// Permissions
|
||||
//------------
|
||||
$this->rights = array();
|
||||
|
||||
@@ -94,11 +94,6 @@ class modCron extends DolibarrModules
|
||||
//------
|
||||
$this->boxes = array();
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$this->rights_class = 'cron';
|
||||
$r=0;
|
||||
|
||||
// Cronjobs
|
||||
$this->cronjobs = array(
|
||||
0=>array('label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>10, 'status'=>1, 'test'=>true),
|
||||
@@ -106,6 +101,11 @@ class modCron extends DolibarrModules
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
|
||||
);
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$this->rights_class = 'cron';
|
||||
$r=0;
|
||||
|
||||
$this->rights[$r][0] = 23001;
|
||||
$this->rights[$r][1] = 'Read cron jobs';
|
||||
$this->rights[$r][3] = 0;
|
||||
|
||||
@@ -78,5 +78,5 @@ CronCannotLoadClass=Cannot load class %s or object %s
|
||||
UseMenuModuleToolsToAddCronJobs=Go into menu "Home - Admin tools - Scheduled jobs" to see and edit scheduled jobs.
|
||||
JobDisabled=Job disabled
|
||||
MakeLocalDatabaseDumpShort=Local database backup
|
||||
MakeLocalDatabaseDump=Create a local database dump
|
||||
MakeLocalDatabaseDump=Create a local database dump. Parameters are: compression ('gz' or 'bz' or 'none'), backup type ('mysql' or 'pgsql'), 1, 'auto' or filename to build, nb 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.
|
||||
|
||||
@@ -432,6 +432,22 @@ class MyObject extends CommonObject
|
||||
$this->initAsSpecimenCommon();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action executed by scheduler
|
||||
* CAN BE A CRON TASK
|
||||
*
|
||||
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
public function doScheduledJob()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -189,7 +189,7 @@ class modMyModule extends DolibarrModules
|
||||
// Cronjobs (List of cron jobs entries to add when module is enabled)
|
||||
// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
|
||||
$this->cronjobs = array(
|
||||
0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/mymodule/class/mymodulemyjob.class.php', 'objectname'=>'MyModuleMyJob', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true)
|
||||
0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/mymodule/class/myobject.class.php', 'objectname'=>'MyObject', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true)
|
||||
);
|
||||
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true)
|
||||
|
||||
Reference in New Issue
Block a user