From 73f1ed8b4fb4888b8251b3575ba1d94cf1a68a4e Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Thu, 21 Feb 2019 22:44:01 +0000 Subject: [PATCH] Some fixes on timesheets.php for clients. --- WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/timesheets.tpl | 62 ++++++++++++++++---------------- timesheets.php | 11 +++--- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index df96c6a1..37f3de1e 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.37.4749 | Copyright © Anuko | +  Anuko Time Tracker 1.18.37.4750 | 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 845a94f2..f9b89d79 100644 --- a/WEB-INF/templates/timesheets.tpl +++ b/WEB-INF/templates/timesheets.tpl @@ -4,7 +4,7 @@ {$forms.timesheetsForm.open} -{if $show_hint} +{if $not_client} {/if} {if $user_dropdown} @@ -13,33 +13,31 @@
{$i18n.form.timesheets.hint}
- {if $inactive_timesheets} +{if $inactive_timesheets} - {/if} +{/if} - {if $show_client} +{if $show_client} - {/if} - {if $show_submit_status} +{/if} +{if $not_client} - {/if} - {if $show_approval_status} - {/if} +{/if} +{if $can_edit} +{/if} - {foreach $active_timesheets as $timesheet} +{foreach $active_timesheets as $timesheet} {if $show_client} {/if} - {if $show_submit_status} + {if $not_client} - {/if} - {if $show_approval_status} {if $timesheet.approval_status == null} {else} @@ -47,17 +45,17 @@ {/if} {/if} - {if !$user->isClient()} + {if $can_edit} {/if} - {/foreach} +{/foreach}
{$i18n.form.timesheets.active_timesheets}
{$i18n.label.thing_name}{$i18n.label.client}{$i18n.label.submitted}{$i18n.label.approved}{$i18n.label.view}{$i18n.label.edit}
{$timesheet.name|escape}{$timesheet.client_name|escape}{if $timesheet.submit_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}{$i18n.label.view}{$i18n.label.edit}
- {if !$user->isClient()} +{if $not_client}

- {/if} +{/if} {if $inactive_timesheets} @@ -68,35 +66,37 @@ {if $show_client} {/if} - {if $show_submit_status} + {if $not_client} - {/if} - {if $show_approval_status} {/if} + {if $can_edit} + {/if} - {foreach $inactive_timesheets as $timesheet} + {foreach $inactive_timesheets as $timesheet} - {if $show_client} + {if $show_client} - {/if} - {if $show_submit_status} + {/if} + {if $not_client} - {/if} - {if $show_approval_status} + {if $timesheet.approval_status == null} + + {else} - {/if} + {/if} + {/if} - {if !$user->isClient()} + {if $can_edit} - {/if} + {/if} - {/foreach} + {/foreach}
{$i18n.label.client}{$i18n.label.submitted}{$i18n.label.approved}{$i18n.label.view}{$i18n.label.edit}
{$timesheet.name|escape}{$timesheet.client_name|escape}{if $timesheet.submit_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}{if $timesheet.approval_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}{$i18n.label.view}{$i18n.label.edit}
- {if !$user->isClient()} + {if $not_client}

diff --git a/timesheets.php b/timesheets.php index 63a1bb34..672e8597 100644 --- a/timesheets.php +++ b/timesheets.php @@ -100,14 +100,15 @@ $active_timesheets = ttTimesheetHelper::getActiveTimesheets($user_id); if ($notClient) $inactive_timesheets = ttTimesheetHelper::getInactiveTimesheets($user_id); -$show_client = $user->isPluginEnabled('cl') && $notClient; +$showClient = $user->isPluginEnabled('cl') && $notClient; +$canEdit = $notClient && ($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', $show_client); -$smarty->assign('show_hint', $notClient); -$smarty->assign('show_submit_status', $notClient); -$smarty->assign('show_approval_status', $notClient); +$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')); $smarty->assign('content_page_name', 'timesheets.tpl'); -- 2.20.1