From fea57466182ea66f11017ab61edbb69410424a13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Oct 2017 18:17:16 +0200 Subject: [PATCH] Standardize look and feel on leave request module --- htdocs/holiday/card.php | 2 +- htdocs/holiday/define_holiday.php | 22 ++++++++++++---------- htdocs/holiday/list.php | 10 +++++----- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 5a6c39840ac..0c11bd1dea1 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -806,7 +806,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print '
'."\n"; print ''."\n"; - dol_fiche_head(); + dol_fiche_head('', '', '', -1); $out=''; $typeleaves=$object->getTypes(1,1); diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 58816d82ff8..032fc8efef0 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -55,7 +55,7 @@ if (! $sortorder) $sortorder="ASC"; if ($user->societe_id > 0) accessforbidden(); // If the user does not have perm to read the page -if(!$user->rights->holiday->read) accessforbidden(); +if (!$user->rights->holiday->read) accessforbidden(); // Initialize technical object to manage context to save list fields @@ -204,7 +204,16 @@ if ($result < 0) setEventMessages($holiday->error, $holiday->errors, 'errors'); } -$filters=''; +$filters = ''; + +// Filter on array of ids of all childs +$userchilds=array(); +if (empty($user->rights->holiday->read_all)) +{ + $userchilds=$user->getAllChildIds(1); + $filters.=' AND u.rowid IN ('.join(', ',$userchilds).')'; +} + $filters.=natural_search(array('u.firstname','u.lastname'), $search_name); if ($search_supervisor > 0) $filters.=natural_search(array('u.fk_user'), $search_supervisor, 2); @@ -231,13 +240,6 @@ 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 ''; $moreforfilter=''; @@ -291,7 +293,7 @@ else { print_liste_field_titre($langs->trans("NoLeaveWithCounterDefined"), $_SERVER["PHP_SELF"], '', '', '', ''); } - print_liste_field_titre($langs->trans('Note'), $_SERVER["PHP_SELF"]); + print_liste_field_titre((empty($user->rights->holiday->define_holiday) ? '' : $langs->trans('Note')), $_SERVER["PHP_SELF"]); print_liste_field_titre(''); print ''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index b041861b9d4..8116028f6df 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -250,13 +250,13 @@ print ''; print ''; if ($id > 0) print ''; -if ($id > 0) +if ($id > 0) // For user tab { $title = $langs->trans("User"); $linkback = ''.$langs->trans("BackToList").''; $head = user_prepare_head($fuser); - dol_fiche_head($head, 'paidholidays', $title, 0, 'user'); + dol_fiche_head($head, 'paidholidays', $title, -1, 'user'); dol_banner_tab($fuser,'id',$linkback,$user->rights->user->user->lire || $user->admin); @@ -277,14 +277,14 @@ 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); - if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) + /*if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) { - dol_fiche_head(''); + dol_fiche_head('', '', '', -1); showMyBalance($holiday, $user_id); dol_fiche_end(); - } + }*/ }