Some fixes on timesheets.php for clients.
authorNik Okuntseff <support@anuko.com>
Thu, 21 Feb 2019 22:44:01 +0000 (22:44 +0000)
committerNik Okuntseff <support@anuko.com>
Thu, 21 Feb 2019 22:44:01 +0000 (22:44 +0000)
WEB-INF/templates/footer.tpl
WEB-INF/templates/timesheets.tpl
timesheets.php

index df96c6a..37f3de1 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.37.4749 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.37.4750 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index 845a94f..f9b89d7 100644 (file)
@@ -4,7 +4,7 @@
 
 {$forms.timesheetsForm.open}
 <table cellspacing="0" cellpadding="7" border="0" width="720">
-{if $show_hint}
+{if $not_client}
   <tr><td align="left">{$i18n.form.timesheets.hint}<br></td></tr>
 {/if}
 {if $user_dropdown}
   <tr>
     <td valign="top">
       <table cellspacing="1" cellpadding="3" border="0" width="100%">
-  {if $inactive_timesheets}
+{if $inactive_timesheets}
         <tr><td class="sectionHeaderNoBorder">{$i18n.form.timesheets.active_timesheets}</td></tr>
-  {/if}
+{/if}
         <tr>
           <td class="tableHeader">{$i18n.label.thing_name}</td>
-  {if $show_client}
+{if $show_client}
           <td class="tableHeader">{$i18n.label.client}</td>
-  {/if}
-  {if $show_submit_status}
+{/if}
+{if $not_client}
           <td class="tableHeader">{$i18n.label.submitted}</td>
-  {/if}
-  {if $show_approval_status}
           <td class="tableHeader">{$i18n.label.approved}</td>
-  {/if}
+{/if}
           <td class="tableHeader">{$i18n.label.view}</td>
+{if $can_edit}
           <td class="tableHeader">{$i18n.label.edit}</td>
+{/if}
         </tr>
-        {foreach $active_timesheets as $timesheet}
+{foreach $active_timesheets as $timesheet}
         <tr valign="top" bgcolor="{cycle values="#f5f5f5,#ffffff"}">
           <td>{$timesheet.name|escape}</td>
   {if $show_client}
           <td>{$timesheet.client_name|escape}</td>
   {/if}
-  {if $show_submit_status}
+  {if $not_client}
           <td>{if $timesheet.submit_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>
-  {/if}
-  {if $show_approval_status}
      {if $timesheet.approval_status == null}
           <td></td>
      {else}
      {/if}
   {/if}
           <td><a href="timesheet_view.php?id={$timesheet.id}">{$i18n.label.view}</a></td>
-  {if !$user->isClient()}
+  {if $can_edit}
           <td><a href="timesheet_edit.php?id={$timesheet.id}">{$i18n.label.edit}</a></td>
   {/if}
         </tr>
-        {/foreach}
+{/foreach}
       </table>
-  {if !$user->isClient()}
+{if $not_client}
       <table width="100%">
         <tr><td align="center"><br><form><input type="button" onclick="chLocation('reports.php');" value="{$i18n.button.add}"></form></td></tr>
       </table>
-  {/if}
+{/if}
 
 {if $inactive_timesheets}
       <table cellspacing="1" cellpadding="3" border="0" width="100%">
   {if $show_client}
           <td class="tableHeader">{$i18n.label.client}</td>
   {/if}
-  {if $show_submit_status}
+  {if $not_client}
           <td class="tableHeader">{$i18n.label.submitted}</td>
-  {/if}
-  {if $show_approval_status}
           <td class="tableHeader">{$i18n.label.approved}</td>
   {/if}
           <td class="tableHeader">{$i18n.label.view}</td>
+  {if $can_edit}
           <td class="tableHeader">{$i18n.label.edit}</td>
+  {/if}
         </tr>
-        {foreach $inactive_timesheets as $timesheet}
+  {foreach $inactive_timesheets as $timesheet}
         <tr valign="top" bgcolor="{cycle values="#f5f5f5,#ffffff"}">
           <td>{$timesheet.name|escape}</td>
-  {if $show_client}
+    {if $show_client}
           <td>{$timesheet.client_name|escape}</td>
-  {/if}
-  {if $show_submit_status}
+    {/if}
+    {if $not_client}
           <td>{if $timesheet.submit_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>
-  {/if}
-  {if $show_approval_status}
+      {if $timesheet.approval_status == null}
+          <td></td>
+      {else}
           <td>{if $timesheet.approval_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td>
-  {/if}
+      {/if}
+    {/if}
           <td><a href="timesheet_view.php?id={$timesheet.id}">{$i18n.label.view}</a></td>
-  {if !$user->isClient()}
+    {if $can_edit}
           <td><a href="timesheet_edit.php?id={$timesheet.id}">{$i18n.label.edit}</a></td>
-  {/if}
+    {/if}
         </tr>
-        {/foreach}
+  {/foreach}
       </table>
-  {if !$user->isClient()}
+  {if $not_client}
       <table width="100%">
         <tr><td align="center"><br><form><input type="button" onclick="chLocation('reports.php');" value="{$i18n.button.add}"></form></td></tr>
       </table>
index 63a1bb3..672e859 100644 (file)
@@ -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');