From 1db52532ff34924a60757c9ec873c4c253bf3d66 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Dec 2021 01:50:17 +0100 Subject: [PATCH] FIX: do not update holiday for closed users --- htdocs/holiday/class/holiday.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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";