Better management of hidden option HOLIDAY_HIDE_BALANCE

This commit is contained in:
Laurent Destailleur 2018-03-19 15:13:36 +01:00
parent eb03fb7540
commit e0164884ee
2 changed files with 29 additions and 18 deletions

View File

@ -831,6 +831,10 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
dol_fiche_end();
}
elseif(! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE))
{
print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>';
}
dol_fiche_head();

View File

@ -130,27 +130,34 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
if (! empty($conf->holiday->enabled))
{
$user_id = $user->id;
if (empty($conf->global->HOLIDAY_HIDE_BALANCE))
{
$user_id = $user->id;
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><th colspan="3">'.$langs->trans("Holidays").'</th></tr>';
print "<tr ".$bc[0].">";
print '<td colspan="3">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><th colspan="3">'.$langs->trans("Holidays").'</th></tr>';
print "<tr ".$bc[0].">";
print '<td colspan="3">';
$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;
$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 '</td>';
print '</tr>';
print '</table><br>';
print '</td>';
print '</tr>';
print '</table><br>';
}
elseif (! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE))
{
print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>';
}
}