From 0eb4f8bb96bb1cf5704bc222710168f41d2226bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Aug 2018 11:47:20 +0200 Subject: [PATCH 1/2] NEW Can set the datestart and dateend of cron job into module descriptor --- htdocs/compta/facture/card.php | 2 +- htdocs/core/modules/DolibarrModules.class.php | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f2a137f0d8f..edabffe98ca 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -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')).'
'; + print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')).'
'; } } print ''; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 8df3f28da3e..c810405d42b 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -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++; } From b648a28893f2cb0a4ea5fe1ced079f2becdea3a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Aug 2018 11:57:43 +0200 Subject: [PATCH 2/2] Fix regression --- htdocs/comm/mailing/cibles.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 13d72acb3d7..519d6c8c08a 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -303,9 +303,11 @@ if ($object->fetch($id) >= 0) // Sort $modulenames sort($modulenames); + $var = true; + // Loop on each submodule - foreach($modulenames as $modulename) - { + foreach($modulenames as $modulename) + { // Loading Class $file = $dir.$modulename.".modules.php"; $classname = "mailing_".$modulename; @@ -326,14 +328,18 @@ if ($object->fetch($id) >= 0) } // Si le module mailing est qualifie + if ($qualified) + { + $var = ! $var; + if ($allowaddtarget) { - print '
'; + print ''; print ''; } else { - print '
'; + print '
'; } print '
';