]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/ttTeamHelper.class.php
Localized top manager role name in list of active users.
[timetracker.git] / WEB-INF / lib / ttTeamHelper.class.php
index a90ee7f63f9a59a3757ecdbbd014d008629a09c2..4e39628a2e1c1e4cb1cdc1745152bab88053f826 100644 (file)
@@ -71,6 +71,7 @@ class ttTeamHelper {
   // The getActiveUsers obtains all active users in a given team.
   static function getActiveUsers($options = null) {
     global $user;
+    global $i18n;
     $mdb2 = getConnection();
 
     if (isset($options['getAllFields']))
@@ -82,6 +83,9 @@ class ttTeamHelper {
     if (is_a($res, 'PEAR_Error'))
       return false;
     while ($val = $res->fetchRow()) {
+      // Localize top manager role name, as it is not localized in db.
+      if ($val['rank'] == 512)
+        $val['role_name'] = $i18n->getKey('role.top_manager.label');
       $user_list[] = $val;
     }
 
@@ -698,7 +702,8 @@ class ttTeamHelper {
     $role_manager = ROLE_MANAGER;
     $sql = "select t.name as team_name, u.id as manager_id, u.name as manager_name, u.login as manager_login, u.email as manager_email
       from tt_teams t
-      inner join tt_users u on (u.team_id = t.id and u.role = $role_manager)
+      inner join tt_users u on (u.team_id = t.id)
+      inner join tt_roles r on (r.id = u.role_id and r.rank = 512)
       where t.id = $team_id";
 
     $res = $mdb2->query($sql);