Browse Source

Enabling student boss relation between user at the same time as friend relation -refs BT#13654

Nicolas Ducoulombier 7 years ago
parent
commit
658e223aca
1 changed files with 4 additions and 4 deletions
  1. 4 4
      main/inc/lib/usermanager.lib.php

+ 4 - 4
main/inc/lib/usermanager.lib.php

@@ -4252,7 +4252,7 @@ class UserManager
                 WHERE
                     friend_user_id='.$friend_id.' AND
                     user_id='.$my_user_id.' AND
-                    relation_type <> '.USER_RELATION_TYPE_RRHH.' ';
+                    relation_type NOT IN('.USER_RELATION_TYPE_RRHH.', '.USER_RELATION_TYPE_BOSS.') ';
         $result = Database::query($sql);
         $row = Database::fetch_array($result, 'ASSOC');
         $current_date = api_get_utc_datetime();
@@ -4268,13 +4268,13 @@ class UserManager
                 WHERE
                     friend_user_id='.$friend_id.' AND
                     user_id='.$my_user_id.' AND
-                    relation_type <> '.USER_RELATION_TYPE_RRHH.' ';
+                    relation_type NOT IN('.USER_RELATION_TYPE_RRHH.', '.USER_RELATION_TYPE_BOSS.') ';
         $result = Database::query($sql);
         $row = Database::fetch_array($result, 'ASSOC');
 
         if ($row['count'] == 1) {
-            //only for the case of a RRHH
-            if ($row['relation_type'] != $relation_type && $relation_type == USER_RELATION_TYPE_RRHH) {
+            //only for the case of a RRHH or a Student BOSS
+            if ($row['relation_type'] != $relation_type && ($relation_type == USER_RELATION_TYPE_RRHH || $relation_type == USER_RELATION_TYPE_BOSS)) {
                 $sql = 'INSERT INTO '.$tbl_my_friend.'(friend_user_id,user_id,relation_type,last_edit)
                         VALUES ('.$friend_id.','.$my_user_id.','.$relation_type.',"'.$current_date.'")';
             } else {