From: Nik Okuntseff Date: Wed, 27 Feb 2019 21:02:28 +0000 (+0000) Subject: A bit of cleanup with ongoing timesheet redesign. X-Git-Tag: timetracker_1.19-1~255 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=88bd95ec82e6b715f84b6bd09c04aebbdb4b5e4d;p=timetracker.git A bit of cleanup with ongoing timesheet redesign. --- diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php index 29347170..d4d24c72 100644 --- a/WEB-INF/resources/ca.lang.php +++ b/WEB-INF/resources/ca.lang.php @@ -467,7 +467,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/cs.lang.php b/WEB-INF/resources/cs.lang.php index c85cb686..2ca15cc9 100644 --- a/WEB-INF/resources/cs.lang.php +++ b/WEB-INF/resources/cs.lang.php @@ -477,7 +477,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/da.lang.php b/WEB-INF/resources/da.lang.php index 3dfb41c8..de4813f6 100644 --- a/WEB-INF/resources/da.lang.php +++ b/WEB-INF/resources/da.lang.php @@ -441,7 +441,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/de.lang.php b/WEB-INF/resources/de.lang.php index c787f6d8..a14e3452 100644 --- a/WEB-INF/resources/de.lang.php +++ b/WEB-INF/resources/de.lang.php @@ -420,7 +420,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index 5c91c3ee..b6f0054b 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -415,7 +415,6 @@ $i18n_key_words = array( 'form.report.assign_to_invoice' => 'Assign to invoice', // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php -'form.timesheets.hint' => 'Use reports to add new timesheets.', 'form.timesheets.active_timesheets' => 'Active Timesheets', 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/es.lang.php b/WEB-INF/resources/es.lang.php index c8674176..99c4431d 100644 --- a/WEB-INF/resources/es.lang.php +++ b/WEB-INF/resources/es.lang.php @@ -480,7 +480,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/et.lang.php b/WEB-INF/resources/et.lang.php index 7f2fe8eb..4f40c7e7 100644 --- a/WEB-INF/resources/et.lang.php +++ b/WEB-INF/resources/et.lang.php @@ -445,7 +445,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/fa.lang.php b/WEB-INF/resources/fa.lang.php index fdbcdba5..566b5081 100644 --- a/WEB-INF/resources/fa.lang.php +++ b/WEB-INF/resources/fa.lang.php @@ -461,7 +461,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/fi.lang.php b/WEB-INF/resources/fi.lang.php index bc66a226..226e8496 100644 --- a/WEB-INF/resources/fi.lang.php +++ b/WEB-INF/resources/fi.lang.php @@ -446,7 +446,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/fr.lang.php b/WEB-INF/resources/fr.lang.php index 840f8559..a90cc042 100644 --- a/WEB-INF/resources/fr.lang.php +++ b/WEB-INF/resources/fr.lang.php @@ -438,7 +438,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/gr.lang.php b/WEB-INF/resources/gr.lang.php index 2ebdaa8f..7257a33f 100644 --- a/WEB-INF/resources/gr.lang.php +++ b/WEB-INF/resources/gr.lang.php @@ -429,7 +429,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/he.lang.php b/WEB-INF/resources/he.lang.php index cac16e9c..47c06c85 100644 --- a/WEB-INF/resources/he.lang.php +++ b/WEB-INF/resources/he.lang.php @@ -468,7 +468,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/hu.lang.php b/WEB-INF/resources/hu.lang.php index f4d5dd13..bd699aca 100644 --- a/WEB-INF/resources/hu.lang.php +++ b/WEB-INF/resources/hu.lang.php @@ -470,7 +470,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/it.lang.php b/WEB-INF/resources/it.lang.php index 3d898e2f..351c1cd6 100644 --- a/WEB-INF/resources/it.lang.php +++ b/WEB-INF/resources/it.lang.php @@ -442,7 +442,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/ja.lang.php b/WEB-INF/resources/ja.lang.php index 7f1a8411..53f1c506 100644 --- a/WEB-INF/resources/ja.lang.php +++ b/WEB-INF/resources/ja.lang.php @@ -475,7 +475,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/ko.lang.php b/WEB-INF/resources/ko.lang.php index c5b7e0a2..d8da0d81 100644 --- a/WEB-INF/resources/ko.lang.php +++ b/WEB-INF/resources/ko.lang.php @@ -473,7 +473,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/nl.lang.php b/WEB-INF/resources/nl.lang.php index 7307ec4a..848e0f34 100644 --- a/WEB-INF/resources/nl.lang.php +++ b/WEB-INF/resources/nl.lang.php @@ -416,7 +416,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/no.lang.php b/WEB-INF/resources/no.lang.php index a0507116..1474cac3 100644 --- a/WEB-INF/resources/no.lang.php +++ b/WEB-INF/resources/no.lang.php @@ -472,7 +472,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/pl.lang.php b/WEB-INF/resources/pl.lang.php index 28e8a0ac..94a094e8 100644 --- a/WEB-INF/resources/pl.lang.php +++ b/WEB-INF/resources/pl.lang.php @@ -449,7 +449,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/pt-br.lang.php b/WEB-INF/resources/pt-br.lang.php index 74e5822f..a10fe4c6 100644 --- a/WEB-INF/resources/pt-br.lang.php +++ b/WEB-INF/resources/pt-br.lang.php @@ -444,7 +444,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/pt.lang.php b/WEB-INF/resources/pt.lang.php index e1e6b29d..9da1e358 100644 --- a/WEB-INF/resources/pt.lang.php +++ b/WEB-INF/resources/pt.lang.php @@ -451,7 +451,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/ro.lang.php b/WEB-INF/resources/ro.lang.php index cf701cf6..70fc0ac1 100644 --- a/WEB-INF/resources/ro.lang.php +++ b/WEB-INF/resources/ro.lang.php @@ -475,7 +475,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/ru.lang.php b/WEB-INF/resources/ru.lang.php index 2fec5db7..6c1daa24 100644 --- a/WEB-INF/resources/ru.lang.php +++ b/WEB-INF/resources/ru.lang.php @@ -406,7 +406,6 @@ $i18n_key_words = array( 'form.report.assign_to_invoice' => 'Включить в счёт', // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php -'form.timesheets.hint' => 'Используйте отчёты для добавления новых табелей.', 'form.timesheets.active_timesheets' => 'Активные табели', 'form.timesheets.inactive_timesheets' => 'Неактивные табели', diff --git a/WEB-INF/resources/sk.lang.php b/WEB-INF/resources/sk.lang.php index 08999f1d..a1253d9b 100644 --- a/WEB-INF/resources/sk.lang.php +++ b/WEB-INF/resources/sk.lang.php @@ -458,7 +458,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/sl.lang.php b/WEB-INF/resources/sl.lang.php index 95d3f858..68e2df6a 100644 --- a/WEB-INF/resources/sl.lang.php +++ b/WEB-INF/resources/sl.lang.php @@ -449,7 +449,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/sr.lang.php b/WEB-INF/resources/sr.lang.php index 170e5409..8976bda5 100644 --- a/WEB-INF/resources/sr.lang.php +++ b/WEB-INF/resources/sr.lang.php @@ -447,7 +447,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/sv.lang.php b/WEB-INF/resources/sv.lang.php index be3f4f28..715481d3 100644 --- a/WEB-INF/resources/sv.lang.php +++ b/WEB-INF/resources/sv.lang.php @@ -445,7 +445,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/tr.lang.php b/WEB-INF/resources/tr.lang.php index e30ddf06..eb92614a 100644 --- a/WEB-INF/resources/tr.lang.php +++ b/WEB-INF/resources/tr.lang.php @@ -486,7 +486,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/zh-cn.lang.php b/WEB-INF/resources/zh-cn.lang.php index 05fa7a88..d31db325 100644 --- a/WEB-INF/resources/zh-cn.lang.php +++ b/WEB-INF/resources/zh-cn.lang.php @@ -458,7 +458,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/resources/zh-tw.lang.php b/WEB-INF/resources/zh-tw.lang.php index 760e9acf..ca0dad53 100644 --- a/WEB-INF/resources/zh-tw.lang.php +++ b/WEB-INF/resources/zh-tw.lang.php @@ -466,7 +466,6 @@ $i18n_key_words = array( // Timesheets form. See example at https://timetracker.anuko.com/timesheets.php // TODO: translate the following. -// form.timesheets.hint' => 'Use reports to add new timesheets.', // 'form.timesheets.active_timesheets' => 'Active Timesheets', // 'form.timesheets.inactive_timesheets' => 'Inactive Timesheets', diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 25f41dec..5b3b25e2 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.46.4790 | Copyright © Anuko | +  Anuko Time Tracker 1.18.46.4791 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/timesheets.tpl b/WEB-INF/templates/timesheets.tpl index f9b89d79..af65d14b 100644 --- a/WEB-INF/templates/timesheets.tpl +++ b/WEB-INF/templates/timesheets.tpl @@ -4,9 +4,6 @@ {$forms.timesheetsForm.open} -{if $not_client} - -{/if} {if $user_dropdown} {/if} diff --git a/timesheets.php b/timesheets.php index 546a7b63..cc43f0dd 100644 --- a/timesheets.php +++ b/timesheets.php @@ -41,48 +41,38 @@ if (!$user->isPluginEnabled('ts')) { exit(); } if ($user->isClient()) { - $users_for_client = ttGroupHelper::getUsersForClient($user->client_id); - if (count($users_for_client) == 0) { - header('Location: access_denied.php'); // There are no users for client. - exit(); - } + header('Location: access_denied.php'); // No timesheets for clients. + exit(); } if ($request->isPost()) { - $userChanged = $request->getParameter('user_changed'); - if ($userChanged && !(ttTimesheetHelper::isUserValid($request->getParameter('user')))) { - header('Location: access_denied.php'); // Wrong user id. + $userChanged = $request->getParameter('user_changed'); // Reused in multiple places below. + if ($userChanged && !($user->can('view_timesheets') && $user->isUserValid($request->getParameter('user')))) { + header('Location: access_denied.php'); // Group changed, but no rght or wrong user id. TODO: research relevance of this... exit(); } } // End of access checks. -// Determine user for whom we display this page. -$notClient = !$user->isClient(); +// Determine user for which we display this page. if ($request->isPost() && $userChanged) { $user_id = $request->getParameter('user'); + $user->setOnBehalfUser($user_id); } else { - if ($notClient) - $user_id = $user->getUser(); - else - $user_id = $users_for_client[0]['id']; // First found user for a client. + $user_id = $user->getUser(); } + $group_id = $user->getGroup(); // Elements of timesheetsForm. $form = new Form('timesheetsForm'); if ($user->can('view_timesheets') || $user->can('view_all_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. - + $rank = $user->getMaxRankForGroup($group_id); + if ($user->can('view_own_timesheets')) + $options = array('status'=>ACTIVE,'max_rank'=>$rank,'include_self'=>true,'self_first'=>true); + else + $options = array('status'=>ACTIVE,'max_rank'=>$rank); + $user_list = $user->getUsers($options); if (count($user_list) >= 1) { $form->addInput(array('type'=>'combobox', 'onchange'=>'document.timesheetsForm.user_changed.value=1;document.timesheetsForm.submit();', @@ -97,17 +87,14 @@ if ($user->can('view_timesheets') || $user->can('view_all_timesheets')) { } $active_timesheets = ttTimesheetHelper::getActiveTimesheets($user_id); -if ($notClient) - $inactive_timesheets = ttTimesheetHelper::getInactiveTimesheets($user_id); +$inactive_timesheets = ttTimesheetHelper::getInactiveTimesheets($user_id); -$showClient = $user->isPluginEnabled('cl') && $notClient; -$canEdit = $notClient && ($user->can('manage_own_timesheets') || - $user->can('manage_timesheets') || $user->can('manage_all_timesheets')); +$showClient = $user->isPluginEnabled('cl'); +$canEdit = $user->can('manage_own_timesheets') || $user->can('manage_timesheets') || $user->can('manage_all_timesheets'); $smarty->assign('active_timesheets', $active_timesheets); $smarty->assign('inactive_timesheets', $inactive_timesheets); $smarty->assign('show_client', $showClient); -$smarty->assign('not_client', $notClient); $smarty->assign('can_edit', $canEdit); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('title', $i18n->get('title.timesheets'));
{$i18n.form.timesheets.hint}
{$i18n.label.user}: {$forms.timesheetsForm.user.control}