]> wagnertech.de Git - timetracker.git/commitdiff
Improved population of on behalf dropdowns on week view and expenses pages.
authorNik Okuntseff <support@anuko.com>
Sun, 25 Mar 2018 21:32:25 +0000 (21:32 +0000)
committerNik Okuntseff <support@anuko.com>
Sun, 25 Mar 2018 21:32:25 +0000 (21:32 +0000)
WEB-INF/templates/footer.tpl
expenses.php
mobile/expenses.php
time.php
week.php

index d1cf3d01b36aa8e9402bfda66a8b2826d2be37a1..2be4b935990893354710c6149aee5dd7d9e14f4a 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.17.71.4166 | 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.71.4167 | 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>
             <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 00b43179c23f3a0a93b22273db09581c8fd608d1..7291414aac7a0af629a5f8085ef2a38897a0e96e 100644 (file)
@@ -42,6 +42,14 @@ if (!$user->isPluginEnabled('ex')) {
   header('Location: feature_disabled.php');
   exit();
 }
   header('Location: feature_disabled.php');
   exit();
 }
+if ($user->behalf_id && (!$user->can('track_expenses') || !$user->checkBehalfId())) {
+  header('Location: access_denied.php'); // Trying on behalf, but no right or wrong user.
+  exit();
+}
+if (!$user->behalf_id && !$user->can('track_own_expenses') && !$user->adjustBehalfId()) {
+  header('Location: access_denied.php'); // Trying as self, but no right for self, and noone to work on behalf.
+  exit();
+}
 
 // Initialize and store date in session.
 $cl_date = $request->getParameter('date', @$_SESSION['date']);
 
 // Initialize and store date in session.
 $cl_date = $request->getParameter('date', @$_SESSION['date']);
@@ -64,9 +72,13 @@ $cl_cost = $request->getParameter('cost');
 // Elements of expensesForm.
 $form = new Form('expensesForm');
 
 // Elements of expensesForm.
 $form = new Form('expensesForm');
 
-if ($user->canManageTeam()) {
-  $user_list = ttTeamHelper::getActiveUsers(array('putSelfFirst'=>true));
-  if (count($user_list) > 1) {
+if ($user->can('track_expenses')) {
+  if ($user->can('track_own_expenses'))
+    $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1,'include_self'=>true,'self_first'=>true);
+  else
+    $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1);
+  $user_list = $user->getUsers($options);
+  if (count($user_list) >= 1) {
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'this.form.submit();',
       'name'=>'onBehalfUser',
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'this.form.submit();',
       'name'=>'onBehalfUser',
index f0fc5c30453867a0dc066ad9011457204edc63db..1cd39c04c4a1ece80c090590c703eb83796ad8f4 100644 (file)
@@ -42,6 +42,14 @@ if (!$user->isPluginEnabled('ex')) {
   header('Location: feature_disabled.php');
   exit();
 }
   header('Location: feature_disabled.php');
   exit();
 }
+if ($user->behalf_id && (!$user->can('track_expenses') || !$user->checkBehalfId())) {
+  header('Location: access_denied.php'); // Trying on behalf, but no right or wrong user.
+  exit();
+}
+if (!$user->behalf_id && !$user->can('track_own_expenses') && !$user->adjustBehalfId()) {
+  header('Location: access_denied.php'); // Trying as self, but no right for self, and noone to work on behalf.
+  exit();
+}
 
 // Initialize and store date in session.
 $cl_date = $request->getParameter('date', @$_SESSION['date']);
 
 // Initialize and store date in session.
 $cl_date = $request->getParameter('date', @$_SESSION['date']);
@@ -68,9 +76,13 @@ $cl_cost = $request->getParameter('cost');
 // Elements of expensesForm.
 $form = new Form('expensesForm');
 
 // Elements of expensesForm.
 $form = new Form('expensesForm');
 
-if ($user->canManageTeam()) {
-  $user_list = ttTeamHelper::getActiveUsers(array('putSelfFirst'=>true));
-  if (count($user_list) > 1) {
+if ($user->can('track_expenses')) {
+  if ($user->can('track_own_expenses'))
+    $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1,'include_self'=>true,'self_first'=>true);
+  else
+    $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1);
+  $user_list = $user->getUsers($options);
+  if (count($user_list) >= 1) {
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'this.form.submit();',
       'name'=>'onBehalfUser',
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'this.form.submit();',
       'name'=>'onBehalfUser',
index 18979fe22b0f5500213688fad05aef50c39e730b..98a383fdd8d1533d158debc820c2c9c91970260b 100644 (file)
--- a/time.php
+++ b/time.php
@@ -51,7 +51,7 @@ if ($user->behalf_id && (!$user->can('track_time') || !$user->checkBehalfId()))
   exit();
 }
 if (!$user->behalf_id && !$user->can('track_own_time') && !$user->adjustBehalfId()) {
   exit();
 }
 if (!$user->behalf_id && !$user->can('track_own_time') && !$user->adjustBehalfId()) {
-  header('Location: access_denied.php'); // Trying as self, but no right for self, and noone to view on behalf.
+  header('Location: access_denied.php'); // Trying as self, but no right for self, and noone to work on behalf.
   exit();
 }
 
   exit();
 }
 
index f1dc7889342fd7a6e9260b77162259312387df97..741a2bb4e28c901a89c2817908a081fa2a18e33e 100644 (file)
--- a/week.php
+++ b/week.php
@@ -47,6 +47,14 @@ if (!$user->isPluginEnabled('wv')) {
   header('Location: feature_disabled.php');
   exit();
 }
   header('Location: feature_disabled.php');
   exit();
 }
+if ($user->behalf_id && (!$user->can('track_time') || !$user->checkBehalfId())) {
+  header('Location: access_denied.php'); // Trying on behalf, but no right or wrong user.
+  exit();
+}
+if (!$user->behalf_id && !$user->can('track_own_time') && !$user->adjustBehalfId()) {
+  header('Location: access_denied.php'); // Trying as self, but no right for self, and noone to work on behalf.
+  exit();
+}
 
 // Initialize and store date in session.
 $cl_date = $request->getParameter('date', @$_SESSION['date']);
 
 // Initialize and store date in session.
 $cl_date = $request->getParameter('date', @$_SESSION['date']);
@@ -203,8 +211,12 @@ class WeekViewCellRenderer extends DefaultCellRenderer {
 $form = new Form('weekTimeForm');
 
 if ($user->can('track_time')) {
 $form = new Form('weekTimeForm');
 
 if ($user->can('track_time')) {
-  $user_list = ttTeamHelper::getActiveUsers(array('putSelfFirst'=>true));
-  if (count($user_list) > 1) {
+  if ($user->can('track_own_time'))
+    $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1,'include_self'=>true,'self_first'=>true);
+  else
+    $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1);
+  $user_list = $user->getUsers($options);
+  if (count($user_list) >= 1) {
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'this.form.submit();',
       'name'=>'onBehalfUser',
     $form->addInput(array('type'=>'combobox',
       'onchange'=>'this.form.submit();',
       'name'=>'onBehalfUser',