Fix type of leave request not visible in list

This commit is contained in:
Laurent Destailleur 2017-10-02 19:36:54 +02:00
parent fea5746618
commit 20b91a8d5f
2 changed files with 7 additions and 4 deletions

View File

@ -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);

View File

@ -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 '<td>'.$userstatic->getNomUrl(-1, 'leave').'</td>';
print '<td>'.$approbatorstatic->getNomUrl(-1).'</td>';
print '<td>';
$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 '</td>';
print '<td align="right">';
$nbopenedday=num_open_day($infos_CP['date_debut_gmt'], $infos_CP['date_fin_gmt'], 0, 1, $infos_CP['halfday']);