From 88c67a664a63623a83ed241054525aa112f9c70c Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Fri, 1 Mar 2019 18:55:38 +0000 Subject: [PATCH] Added conditional display of show approvers. --- WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/timesheet_view.tpl | 2 +- timesheet_view.php | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index f81320ad..246dfca2 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- diff --git a/timesheet_view.php b/timesheet_view.php index 9b5b4cdf..813edffb 100644 --- a/timesheet_view.php +++ b/timesheet_view.php @@ -58,7 +58,10 @@ $totals = ttReportHelper::getTotals($options); // Determine which controls to show and obtain date for them. $showSubmit = !$timesheet['submit_status']; -if ($showSubmit) $approvers = ttTimesheetHelper::getApprovers($timesheet['user_id']); +if ($showSubmit) { + $approvers = ttTimesheetHelper::getApprovers($timesheet['user_id']); + $showApprovers = count($approvers) >= 1; +} $canApprove = $user->can('approve_timesheets') || $user->can('approve_own_timesheets'); $showApprove = $timesheet['submit_status'] && $timesheet['approval_status'] == null; @@ -67,7 +70,7 @@ $form = new Form('timesheetForm'); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$timesheet['id'])); if ($showSubmit) { - if (count($approvers) >= 1) { + if ($showApprovers) { $form->addInput(array('type'=>'combobox', 'name'=>'approver', 'style'=>'width: 200px;', @@ -124,6 +127,7 @@ $smarty->assign('group_by_header', ttReportHelper::makeGroupByHeader($options)); $smarty->assign('timesheet', $timesheet); $smarty->assign('subtotals', $subtotals); $smarty->assign('totals', $totals); +$smarty->assign('show_approvers', $showApprovers); $smarty->assign('show_submit', $showSubmit); $smarty->assign('show_approve', $showApprove); $smarty->assign('forms', array($form->getName()=>$form->toArray())); -- 2.20.1
 Anuko Time Tracker 1.18.47.4802 | Copyright © Anuko | +  Anuko Time Tracker 1.18.47.4803 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/timesheet_view.tpl b/WEB-INF/templates/timesheet_view.tpl index e6988253..bce187e7 100644 --- a/WEB-INF/templates/timesheet_view.tpl +++ b/WEB-INF/templates/timesheet_view.tpl @@ -53,7 +53,7 @@
- +
{$i18n.form.mail.to}: {$forms.timesheetForm.approver.control} {$forms.timesheetForm.btn_submit.control}
{if $show_approvers}{$i18n.form.mail.to}: {$forms.timesheetForm.approver.control}{/if} {$forms.timesheetForm.btn_submit.control}