diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 8541454e549e5429438639b9acacba96314985fb..9c7ff195018f79cd32c4789b701dba08525b24c7 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -260,9 +260,16 @@ if ($id > 0) dol_banner_tab($fuser,'id',$linkback,$user->rights->user->user->lire || $user->admin); - print '<div class="underbanner clearboth"></div>'; + if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) + { + print '<div class="underbanner clearboth"></div>'; + + print '<br>'; - print '<br>'; + showMyBalance($holiday, $user_id); + } + + dol_fiche_end(); } else { @@ -270,23 +277,43 @@ else //print count($holiday->holiday); print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, "", $num, count($holiday->holiday), 'title_hrm.png', 0, '', '', $limit); - dol_fiche_head(''); + if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) + { + dol_fiche_head(''); + + showMyBalance($holiday, $user_id); + + dol_fiche_end(); + } } -$alltypeleaves=$holiday->getTypes(1,-1); // To have labels -$out=''; -$typeleaves=$holiday->getTypes(1,1); -foreach($typeleaves as $key => $val) + +/** + * Show balance of user + * + * @param Holiday $holiday Object $holiday + * @param int $user_id User id + * @return string Html code with balance + */ +function showMyBalance($holiday, $user_id) { - $nb_type = $holiday->getCPforUser($user_id, $val['rowid']); - $nb_holiday += $nb_type; - $out .= ' - '.$val['label'].': <strong>'.($nb_type?price2num($nb_type):0).'</strong><br>'; + global $conf, $langs; + + $alltypeleaves=$holiday->getTypes(1,-1); // To have labels + + $out=''; + $typeleaves=$holiday->getTypes(1,1); + foreach($typeleaves as $key => $val) + { + $nb_type = $holiday->getCPforUser($user_id, $val['rowid']); + $nb_holiday += $nb_type; + $out .= ' - '.$val['label'].': <strong>'.($nb_type?price2num($nb_type):0).'</strong><br>'; + } + print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'<br>'; + print $out; } -print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'<br>'; -print $out; -dol_fiche_end(); if ($id > 0) print '<br>';