Fix duplicate code
This commit is contained in:
parent
dabd882056
commit
044feab00f
@ -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>';
|
||||
}
|
||||
print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'<br>';
|
||||
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'].': <strong>'.($nb_type?price2num($nb_type):0).'</strong><br>';
|
||||
}
|
||||
print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'<br>';
|
||||
print $out;
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if ($id > 0) print '<br>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user