A few fixes to users pages for subgroups.
authorNik Okuntseff <support@anuko.com>
Wed, 12 Dec 2018 18:48:35 +0000 (18:48 +0000)
committerNik Okuntseff <support@anuko.com>
Wed, 12 Dec 2018 18:48:35 +0000 (18:48 +0000)
WEB-INF/templates/footer.tpl
WEB-INF/templates/mobile/users.tpl
mobile/users.php
users.php

index d7560f9..51675b0 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.29.4637 | 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.29.4638 | 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 ae04bd4..b3af8e2 100644 (file)
@@ -22,7 +22,7 @@
             {if $uncompleted_indicators}
               <span class="uncompleted-entry{if $u.has_uncompleted_entry} active{/if}"{if $u.has_uncompleted_entry} title="{$i18n.form.users.uncompleted_entry}"{/if}></span>
             {/if}
-            {if $u.rank < $user->rank || ($u.rank == $user->rank && $u.id == $user->id)}
+            {if $u.group_id != $user->group_id || $u.rank < $user->rank || ($u.rank == $user->rank && $u.id == $user->id)}
               <a href="user_edit.php?id={$u.id}">{$u.name|escape}</a>
             {else}
               {$u.name|escape}
@@ -54,7 +54,7 @@
     {foreach $inactive_users as $u}
         <tr bgcolor="{cycle values="#f5f5f5,#ffffff"}">
           <td>
-            {if $u.rank < $user->rank}
+            {if $u.group_id != $user->group_id || $u.rank < $user->rank}
               <a href="user_edit.php?id={$u.id}">{$u.name|escape}</a>
             {else}
               {$u.name|escape}
index 0c54751..d6d0845 100644 (file)
@@ -40,15 +40,16 @@ if (!(ttAccessAllowed('view_users') || ttAccessAllowed('manage_users'))) {
 // End of access checks.
 
 // Prepare a list of active users.
+$rank = $user->getMaxRankForGroup($user->getGroup());
 if ($user->can('view_users'))
   $options = array('status'=>ACTIVE,'include_clients'=>true,'include_login'=>true,'include_role'=>true);
 else /* if ($user->can('manage_users')) */
-  $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1,'include_clients'=>true,'include_self'=>true,'include_login'=>true,'include_role'=>true);
+  $options = array('status'=>ACTIVE,'max_rank'=>$rank,'include_clients'=>true,'include_self'=>true,'include_login'=>true,'include_role'=>true);
 $active_users = $user->getUsers($options);
 
 // Prepare a list of inactive users.
 if($user->can('manage_users')) {
-  $options = array('status'=>INACTIVE,'max_rank'=>$user->rank-1,'include_clients'=>true,'include_login'=>true,'include_role'=>true);
+  $options = array('status'=>INACTIVE,'max_rank'=>$rank,'include_clients'=>true,'include_login'=>true,'include_role'=>true);
   $inactive_users = $user->getUsers($options);
 }
 
index d19ba7d..fd9e759 100644 (file)
--- a/users.php
+++ b/users.php
@@ -39,15 +39,16 @@ if (!(ttAccessAllowed('view_users') || ttAccessAllowed('manage_users'))) {
 // End of access checks.
 
 // Prepare a list of active users.
+$rank = $user->getMaxRankForGroup($user->getGroup());
 if ($user->can('view_users'))
   $options = array('status'=>ACTIVE,'include_clients'=>true,'include_login'=>true,'include_role'=>true);
 else /* if ($user->can('manage_users')) */
-  $options = array('status'=>ACTIVE,'max_rank'=>$user->rank-1,'include_clients'=>true,'include_self'=>true,'include_login'=>true,'include_role'=>true);
+  $options = array('status'=>ACTIVE,'max_rank'=>$rank,'include_clients'=>true,'include_self'=>true,'include_login'=>true,'include_role'=>true);
 $active_users = $user->getUsers($options);
 
 // Prepare a list of inactive users.
 if($user->can('manage_users')) {
-  $options = array('status'=>INACTIVE,'max_rank'=>$user->rank-1,'include_clients'=>true,'include_login'=>true,'include_role'=>true);
+  $options = array('status'=>INACTIVE,'max_rank'=>$rank,'include_clients'=>true,'include_login'=>true,'include_role'=>true);
   $inactive_users = $user->getUsers($options);
 }