diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 8776060b60f..581de47178c 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -167,15 +167,16 @@ class Conf * Load setup values into conf object (read llx_const) for a specified entity * Note that this->db->xxx, this->file->xxx and this->multicompany have been already loaded when setValues is called. * + * @param DoliDB $db Database handler * @param int $entity Entity to get * @return int < 0 if KO, >= 0 if OK */ - public function setEntityValues($entity) + public function setEntityValues($db, $entity) { if ($this->entity != $entity) { // If we ask to reload setup for a new entity $this->entity = $entity; - return $this->setValues($this->db); + return $this->setValues($db); } return 0; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 34fe7b6cd58..44564e1b0ab 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1081,7 +1081,7 @@ class Cronjob extends CommonObject dol_syslog("We try to run a job in entity ".$this->entity." when we are in entity ".$conf->entity, LOG_WARNING); } $savcurrententity = $conf->entity; - $conf->setEntityValues($this->entity); + $conf->setEntityValues($this->db, $this->entity); dol_syslog(get_class($this)."::run_jobs entity for running job is ".$conf->entity); require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -1090,13 +1090,13 @@ class Cronjob extends CommonObject if ($result < 0) { $this->error = "User Error:".$user->error; dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); - $conf->setEntityValues($savcurrententity); + $conf->setEntityValues($this->db, $savcurrententity); return -1; } else { if (empty($user->id)) { $this->error = " User user login:".$userlogin." do not exists"; dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); - $conf->setEntityValues($savcurrententity); + $conf->setEntityValues($this->db, $savcurrententity); return -1; } } @@ -1126,7 +1126,7 @@ class Cronjob extends CommonObject $result = $this->update($user); // This include begin/commit if ($result < 0) { dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); - $conf->setEntityValues($savcurrententity); + $conf->setEntityValues($this->db, $savcurrententity); return -1; } @@ -1241,7 +1241,7 @@ class Cronjob extends CommonObject if ($ret === false) { $this->error = $langs->trans('CronCannotLoadLib').': '.$libpath; dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); - $conf->setEntityValues($savcurrententity); + $conf->setEntityValues($this->db, $savcurrententity); return -1; } @@ -1250,7 +1250,7 @@ class Cronjob extends CommonObject $result = $langs->load($this->module_name.'@'.$this->module_name); // If this->module_name was an existing language file, this will make nothing if ($result < 0) { // If technical error dol_syslog(get_class($this)."::run_jobs Cannot load module langs".$langs->error, LOG_ERR); - $conf->setEntityValues($savcurrententity); + $conf->setEntityValues($this->db, $savcurrententity); return -1; } @@ -1316,11 +1316,11 @@ class Cronjob extends CommonObject $result = $this->update($user); // This include begin/commit if ($result < 0) { dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR); - $conf->setEntityValues($savcurrententity); + $conf->setEntityValues($this->db, $savcurrententity); return -1; } - $conf->setEntityValues($savcurrententity); + $conf->setEntityValues($this->db, $savcurrententity); return $error ?-1 : 1; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 89760c4d1ac..9a45a735716 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1470,11 +1470,11 @@ class Holiday extends CommonObject $monthLastUpdate = $lastUpdate[4].$lastUpdate[5]; //print 'month: '.$month.' lastUpdate:'.$lastUpdate.' monthLastUpdate:'.$monthLastUpdate;exit; - // Si la date du mois n'est pas la même que celle sauvegardée, on met à jour le timestamp + // If month date is not same than the one of last update (the one we saved in database), then we update the timestamp and balance of each open user. if ($month != $monthLastUpdate) { $this->db->begin(); - $users = $this->fetchUsers(false, false); + $users = $this->fetchUsers(false, false, ' AND u.statut > 0'); $nbUser = count($users); $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; @@ -1675,7 +1675,7 @@ class Holiday extends CommonObject * * @param boolean $stringlist If true return a string list of id. If false, return an array with detail. * @param boolean $type If true, read Dolibarr user list, if false, return vacation balance list. - * @param string $filters Filters + * @param string $filters Filters. Warning: This must not contains data from user input. * @return array|string|int Return an array */ public function fetchUsers($stringlist = true, $type = true, $filters = '') @@ -1776,7 +1776,7 @@ class Holiday extends CommonObject // Si faux donc return array // List for Dolibarr users if ($type) { - // If user of Dolibarr + // If we need users of Dolibarr $sql = "SELECT"; if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $sql .= " DISTINCT"; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 0ecdcb2dd69..207c7c31707 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -890,14 +890,15 @@ if ($resql) { $i++; } + // Add a line for total if there is a total to show if (!empty($arrayfields['duration']['checked'])) { - print '