diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 6d74aa109e0..71d456f8e16 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -214,6 +214,16 @@ if (count($typeleaves) == 0) } else { + $canedit=0; + if (! empty($user->rights->holiday->define_holiday)) $canedit=1; + + // Get array of ids of all childs + $userchilds=array(); + if (empty($user->rights->holiday->read_all)) + { + $userchilds=$user->getAllChildIds(); + } + print '
'."\n"; print ''; @@ -231,23 +241,18 @@ else { print ''.$langs->trans("NoLeaveWithCounterDefined").''; } - print ''.$langs->trans('Note').''; + print ''; + if ($canedit) print $langs->trans('Note'); + print ''; print ''; print ''; - // Get array of ids of all childs - $userchilds=array(); - if (empty($user->rights->holiday->define_holiday)) - { - $userchilds=$user->getAllChildIds(); - } - foreach($listUsers as $users) { $var=!$var; // If user has not permission to edit/read all, we must see only subordinates - if (empty($user->rights->holiday->define_holiday)) + if (empty($user->rights->holiday->read_all)) { if (($users['rowid'] != $user->id) && (! in_array($users['rowid'], $userchilds))) continue; // This user is not into hierarchy of current user, we hide it. } @@ -267,7 +272,8 @@ else $nbtoshow=''; if ($holiday->getCPforUser($users['rowid'], $val['rowid']) != '') $nbtoshow=price2num($holiday->getCPforUser($users['rowid'], $val['rowid']), 5); print ''; - print ''; + if ($canedit) print ''; + else print $nbtoshow; //print ' '.$langs->trans('days'); print ''."\n"; } @@ -276,8 +282,15 @@ else { print ''; } - print ''; - print ''."\n"; + print ''; + if ($canedit) print ''; + print ''; + print ''; + if (! empty($user->rights->holiday->define_holiday)) + { + print ''; + } + print ''."\n"; print ''; $i++;