From a3ec528f0b31400a9cdda44211ae495a6512c648 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Wed, 20 Feb 2019 17:00:53 +0000 Subject: [PATCH] Some fixes to timesheets.php page. --- WEB-INF/templates/footer.tpl | 2 +- timesheets.php | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 751fe2e2..ae33f157 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.37.4744 | Copyright © Anuko | +  Anuko Time Tracker 1.18.37.4745 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/timesheets.php b/timesheets.php index 82a83074..0a926d91 100644 --- a/timesheets.php +++ b/timesheets.php @@ -66,20 +66,23 @@ if ($request->isPost() && $userChanged) { else $user_id = $users_for_client[0]['id']; // First found user for a client. } - - $group_id = $user->getGroup(); // Elements of timesheetsForm. $form = new Form('timesheetsForm'); -if ($user->can('view_timesheets') || $user->can('view_all_timesheets') || $user->can('manage_timesheets') || $user->can('manage_all_timesheets')) { - $rank = $user->getMaxRankForGroup($group_id); - if ($user->can('track_own_time')) - $options = array('group_id'=>$group_id,'status'=>ACTIVE,'max_rank'=>$rank,'include_self'=>true,'self_first'=>true); - else - $options = array('group_id'=>$group_id,'status'=>ACTIVE,'max_rank'=>$rank); - $user_list = $user->getUsers($options); +if ($user->can('view_timesheets') || $user->can('view_all_timesheets') || $user->can('view_client_timesheets')) { + // Prepare user list for dropdown. + if ($notClient) { + $rank = $user->can('view_all_timesheets') ? MAX_RANK : $user->getMaxRankForGroup($group_id); + if ($user->can('view_own_timesheets')) + $options = array('max_rank'=>$rank,'include_self'=>true,'self_first'=>true); + else + $options = array('max_rank'=>$rank); + $user_list = $user->getUsers($options); + } else + $user_list = $users_for_client; // Obtained above. + if (count($user_list) >= 1) { $form->addInput(array('type'=>'combobox', 'onchange'=>'document.timesheetsForm.user_changed.value=1;document.timesheetsForm.submit();', -- 2.20.1