diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php
index 8541454e549..9c7ff195018 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 '
';
+ if (empty($conf->global->HOLIDAY_HIDE_BALANCE))
+ {
+ print '';
- print '
';
+ print '
';
+
+ 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'].': '.($nb_type?price2num($nb_type):0).'
';
-}
-print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'
';
-print $out;
+ 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'].': '.($nb_type?price2num($nb_type):0).'
';
+ }
+ print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'
';
+ print $out;
+}
-dol_fiche_end();
if ($id > 0) print '
';