NEW Can set the datestart and dateend of cron job into module descriptor

This commit is contained in:
Laurent Destailleur 2018-08-29 11:47:20 +02:00
parent fde9c94b1c
commit 0eb4f8bb96
2 changed files with 8 additions and 5 deletions

View File

@ -3705,7 +3705,7 @@ else if ($id > 0 || ! empty($ref))
$discount = new DiscountAbsolute($db);
$result = $discount->fetch(0, $object->id);
if ($result > 0){
print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(), $discount->getNomUrl(1, 'discount')).'<br>';
print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')).'<br>';
}
}
print '</td></tr>';

View File

@ -1323,8 +1323,10 @@ class DolibarrModules // Can not be abstract, because we need to insta
$status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:'';
$priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:'';
$test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be visible
$datestart = isset($this->cronjobs[$key]['datestart'])?$this->cronjobs[$key]['datestart']:'';
$dateend = isset($this->cronjobs[$key]['dateend'])?$this->cronjobs[$key]['dateend']:'';
// Search if boxes def already present
// Search if cron entry already present
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'";
if ($class) $sql.= " AND classesname = '".$this->db->escape($class)."'";
@ -1345,7 +1347,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
if (! $err)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob (module_name, datec, datestart, label, jobtype, classesname, objectname, methodename, command, params, note,";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob (module_name, datec, datestart, dateend, label, jobtype, classesname, objectname, methodename, command, params, note,";
if(is_int($frequency)){ $sql.= ' frequency,'; }
if(is_int($unitfrequency)){ $sql.= ' unitfrequency,'; }
if(is_int($priority)){ $sql.= ' priority,'; }
@ -1354,7 +1356,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
$sql.= " VALUES (";
$sql.= "'".$this->db->escape($this->rights_class)."', ";
$sql.= "'".$this->db->idate($now)."', ";
$sql.= "'".$this->db->idate($now)."', ";
$sql.= ($datestart ? "'".$this->db->idate($datestart)."'" : "NULL").", ";
$sql.= ($dateend ? "'".$this->db->idate($dateend)."'" : "NULL").", ";
$sql.= "'".$this->db->escape($label)."', ";
$sql.= "'".$this->db->escape($jobtype)."', ";
$sql.= ($class?"'".$this->db->escape($class)."'":"null").",";
@ -1389,7 +1392,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
// else box already registered into database
}
else
{
{
$this->error=$this->db->lasterror();
$err++;
}