diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 1a71889ec1f..9486a4a1447 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -292,7 +292,8 @@ class Holiday extends CommonObject $sql.= " cp.rowid,"; $sql.= " cp.fk_user,"; - $sql.= " cp.date_create,"; + $sql.= " cp.fk_type,"; + $sql.= " cp.date_create,"; $sql.= " cp.description,"; $sql.= " cp.date_debut,"; $sql.= " cp.date_fin,"; @@ -322,7 +323,7 @@ class Holiday extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua"; $sql.= " WHERE cp.entity IN (".getEntity('holiday').")"; $sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau - $sql.= " AND cp.fk_user = '".$user_id."'"; + $sql.= " AND cp.fk_user = ".$user_id; // Filtre de séléction if(!empty($filter)) { @@ -357,6 +358,7 @@ class Holiday extends CommonObject $tab_result[$i]['rowid'] = $obj->rowid; $tab_result[$i]['ref'] = $obj->rowid; $tab_result[$i]['fk_user'] = $obj->fk_user; + $tab_result[$i]['fk_type'] = $obj->fk_type; $tab_result[$i]['date_create'] = $this->db->jdate($obj->date_create); $tab_result[$i]['description'] = $obj->description; $tab_result[$i]['date_debut'] = $this->db->jdate($obj->date_debut); diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 8116028f6df..c5a074d0e71 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -433,6 +433,8 @@ if (! empty($holiday->holiday)) $userstatic = new User($db); $approbatorstatic = new User($db); + $typeleaves=$holiday->getTypes(1,-1); + foreach($holiday->holiday as $infos_CP) { // User @@ -463,8 +465,7 @@ if (! empty($holiday->holiday)) print ''.$userstatic->getNomUrl(-1, 'leave').''; print ''.$approbatorstatic->getNomUrl(-1).''; print ''; - $label=$alltypeleaves[$infos_CP['fk_type']]['label']; - print $label?$label:$infos_CP['fk_type']; + print empty($typeleaves[$infos_CP['fk_type']]['label']) ? $langs->trans("TypeWasDisabledOrRemoved",$infos_CP['fk_type']) : $typeleaves[$infos_CP['fk_type']]['label']; print ''; print ''; $nbopenedday=num_open_day($infos_CP['date_debut_gmt'], $infos_CP['date_fin_gmt'], 0, 1, $infos_CP['halfday']);