From c4543eff73244ee05c7d5e502c24a6fac956acc6 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Fri, 28 Oct 2022 16:31:01 +0200 Subject: [PATCH] FIX: Fix the request SQL for transversal user, the join on usergroup table must be with getEntity('usergroup') and not other element --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/user/class/user.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a3a72d4894a..27b00377411 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2072,7 +2072,7 @@ abstract class CommonObject $sql .= " AND te.entity IS NOT NULL"; // Show all users } else { $sql .= " AND ug.fk_user = te.rowid"; - $sql .= " AND ug.entity IN (".getEntity($this->element).")"; + $sql .= " AND ug.entity IN (".getEntity('usergroup').")"; } } else { $sql .= ' AND te.entity IN ('.getEntity($this->element).')'; @@ -2142,7 +2142,7 @@ abstract class CommonObject $sql .= " AND te.entity IS NOT NULL"; // Show all users } else { $sql .= " AND ug.fk_user = te.rowid"; - $sql .= " AND ug.entity IN (".getEntity($this->element).")"; + $sql .= " AND ug.entity IN (".getEntity('usergroup').")"; } } else { $sql .= ' AND te.entity IN ('.getEntity($this->element).')'; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 04eebd6b6c9..1543d579839 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3490,7 +3490,7 @@ class User extends CommonObject } else { $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; $sql .= " WHERE ((ug.fk_user = t.rowid"; - $sql .= " AND ug.entity IN (".getEntity('user')."))"; + $sql .= " AND ug.entity IN (".getEntity('usergroup')."))"; $sql .= " OR t.entity = 0)"; // Show always superadmin } } else {