From 449678d687636b882369cafb69657fb0b5dbfc6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 May 2014 12:43:07 +0200 Subject: [PATCH] Fix: get_full_tree must follow same filter rule thant list of users --- htdocs/user/class/user.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 62e7f792d66..f62467e0a67 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2235,8 +2235,14 @@ class User extends CommonObject // Init $this->users array $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.login, u.statut"; // Distinct reduce pb with old tables with duplicates $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; - + if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && (! empty($conf->multicompany->transverse_mode) || (! empty($user->admin) && empty($user->entity)))) + { + $sql.= " WHERE u.entity IS NOT NULL"; + } + else + { + $sql.= " WHERE u.entity IN (".getEntity('user',1).")"; + } dol_syslog(get_class($this)."::get_full_tree get user list sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql)