Browse Source

Use "id" instead of "user_id" field in groups classes when referring to the user table (user_id is deprecated) - refs CT#7909

Yannick Warnier 9 years ago
parent
commit
126620165c
2 changed files with 16 additions and 16 deletions
  1. 7 7
      main/inc/lib/group_portal_manager.lib.php
  2. 9 9
      main/inc/lib/usergroup.lib.php

+ 7 - 7
main/inc/lib/group_portal_manager.lib.php

@@ -569,12 +569,12 @@ class GroupPortalManager
 
         $sql = "SELECT
                     picture_uri as image,
-                    u.user_id,
+                    u.id,
                     u.firstname,
                     u.lastname,
                     relation_type
     		    FROM $tbl_user u INNER JOIN $table_group_rel_user gu
-    			ON (gu.user_id = u.user_id)
+    			ON (gu.user_id = u.id)
     			WHERE
     			    gu.group_id= $group_id
     			    $where_relation_condition
@@ -584,10 +584,10 @@ class GroupPortalManager
         $array = array();
         while ($row = Database::fetch_array($result, 'ASSOC')) {
             if ($with_image) {
-                $picture = UserManager::getUserPicture($row['user_id']);
+                $picture = UserManager::getUserPicture($row['id']);
                 $row['image'] = '<img src="'.$picture.'" />';
             }
-            $array[$row['user_id']] = $row;
+            $array[$row['id']] = $row;
         }
 
         return $array;
@@ -607,17 +607,17 @@ class GroupPortalManager
         if (empty($group_id)) {
             return array();
         }
-        $sql = "SELECT u.user_id, u.firstname, u.lastname, relation_type
+        $sql = "SELECT u.id, u.firstname, u.lastname, relation_type
                 FROM $tbl_user u
                 INNER JOIN $table_group_rel_user gu
-                ON (gu.user_id = u.user_id)
+                ON (gu.user_id = u.id)
                 WHERE gu.group_id= $group_id
                 ORDER BY relation_type, firstname";
 
         $result = Database::query($sql);
         $array = array();
         while ($row = Database::fetch_array($result, 'ASSOC')) {
-            $array[$row['user_id']] = $row;
+            $array[$row['id']] = $row;
         }
         return $array;
     }

+ 9 - 9
main/inc/lib/usergroup.lib.php

@@ -1269,7 +1269,7 @@ class UserGroup extends Model
         $id = intval($id);
         $sql = "SELECT u.* FROM ".$this->table_user." u
                 INNER JOIN ".$this->usergroup_rel_user_table." c
-                ON c.user_id = u.user_id
+                ON c.user_id = u.id
                 WHERE c.usergroup_id = $id"
                 ;
         $result = Database::query($sql);
@@ -1905,10 +1905,10 @@ class UserGroup extends Model
                 $where_relation_condition = "AND gu.relation_type IN ($relation_type) ";
         }
 
-        $sql = "SELECT picture_uri as image, u.user_id, u.firstname, u.lastname, relation_type
+        $sql = "SELECT picture_uri as image, u.id, u.firstname, u.lastname, relation_type
     		    FROM $tbl_user u
     		    INNER JOIN $table_group_rel_user gu
-    			ON (gu.user_id = u.user_id)
+    			ON (gu.user_id = u.id)
     			WHERE
     			    gu.usergroup_id= $group_id
     			    $where_relation_condition
@@ -1919,13 +1919,13 @@ class UserGroup extends Model
         $array  = array();
         while ($row = Database::fetch_array($result, 'ASSOC')) {
             if ($with_image) {
-                $userInfo = api_get_user_info($row['user_id']);
-                $userPicture = UserManager::getUserPicture($row['user_id']);
+                $userInfo = api_get_user_info($row['id']);
+                $userPicture = UserManager::getUserPicture($row['id']);
 
                 $row['image'] = '<img src="'.$userPicture.'"  />';
                 $row['user_info'] = $userInfo;
             }
-            $array[$row['user_id']] = $row;
+            $array[$row['id']] = $row;
         }
         return $array;
     }
@@ -1946,17 +1946,17 @@ class UserGroup extends Model
             return array();
         }
 
-        $sql = "SELECT u.user_id, u.firstname, u.lastname, relation_type
+        $sql = "SELECT u.id, u.firstname, u.lastname, relation_type
                 FROM $tbl_user u
 			    INNER JOIN $table_group_rel_user gu
-			    ON (gu.user_id = u.user_id)
+			    ON (gu.user_id = u.id)
 			    WHERE gu.usergroup_id= $group_id
 			    ORDER BY relation_type, firstname";
 
         $result=Database::query($sql);
         $array = array();
         while ($row = Database::fetch_array($result, 'ASSOC')) {
-            $array[$row['user_id']] = $row;
+            $array[$row['id']] = $row;
         }
         return $array;
     }