More progress on replacing canManagerTeam() with rights checks.
authorNik Okuntseff <support@anuko.com>
Sat, 14 Apr 2018 12:40:32 +0000 (12:40 +0000)
committerNik Okuntseff <support@anuko.com>
Sat, 14 Apr 2018 12:40:32 +0000 (12:40 +0000)
WEB-INF/templates/footer.tpl
WEB-INF/templates/reports.tpl
reports.php

index 8853f5d..09a969e 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.17.88.4264 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.17.88.4265 | 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 640a55c..8aa7f6d 100644 (file)
@@ -201,13 +201,17 @@ function handleCheckboxes() {
         <tr>
           <td><b>{$i18n.form.time.billable}</b></td>
           <td>&nbsp;</td>
+  {if $user->can('manage_invoices')}
           <td><b>{$i18n.label.invoice}</b></td>
+  {/if}
         </tr>
         <tr valign="top">
           <td>{$forms.reportForm.include_records.control}</td>
           <td>&nbsp;</td>
+  {if $user->can('manage_invoices')}
           <td>{$forms.reportForm.invoice.control}</td>
         </tr>
+  {/if}
 {/if}
 {if ($user->can('manage_invoices') && $user->isPluginEnabled('ps'))}
         <tr>
index 11d1434..bc6d8fc 100644 (file)
@@ -90,8 +90,8 @@ if ($custom_fields && $custom_fields->fields[0] && $custom_fields->fields[0]['ty
 }
 
 // Add controls for projects and tasks.
-if ($user->canManageTeam()) {
-  $project_list = ttProjectHelper::getProjects(); // Manager and co-managers can run reports on all active and inactive projects.
+if ($user->can('view_reports') || $user->can('view_all_reports')) {
+  $project_list = ttProjectHelper::getProjects(); // All active and inactive projects.
 } elseif ($user->isClient()) {
   $project_list = ttProjectHelper::getProjectsForClient();
 } else {
@@ -124,15 +124,17 @@ $form->addInput(array('type'=>'combobox',
   'empty'=>array(''=>$i18n->get('dropdown.all'))));
 
 // Add invoiced / not invoiced selector.
-$invoice_options = array('1'=>$i18n->get('form.reports.include_invoiced'),
-  '2'=>$i18n->get('form.reports.include_not_invoiced'));
-$form->addInput(array('type'=>'combobox',
-  'name'=>'invoice',
-  'style'=>'width: 250px;',
-  'data'=>$invoice_options,
-  'empty'=>array(''=>$i18n->get('dropdown.all'))));
+if ($user->can('manage_invoices')) {
+  $invoice_options = array('1'=>$i18n->get('form.reports.include_invoiced'),
+    '2'=>$i18n->get('form.reports.include_not_invoiced'));
+  $form->addInput(array('type'=>'combobox',
+    'name'=>'invoice',
+    'style'=>'width: 250px;',
+    'data'=>$invoice_options,
+    'empty'=>array(''=>$i18n->get('dropdown.all'))));
+}
 
-if ($user->canManageTeam() && $user->isPluginEnabled('ps')) {
+if ($user->can('manage_invoices') && $user->isPluginEnabled('ps')) {
   $form->addInput(array('type'=>'combobox',
    'name'=>'paid_status',
    'style'=>'width: 250px;',