From 69888aa569c1ad6c4761cbf039c294029cf93743 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <ldestailleur@teclib.com> Date: Thu, 7 Aug 2014 20:11:39 +0200 Subject: [PATCH] Fix: get_full_tree was not working correctly. --- htdocs/user/class/user.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ac4c830fed2..8c607b0a347 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2196,8 +2196,8 @@ class User extends CommonObject // Load array[child]=parent $sql = "SELECT fk_user as id_parent, rowid as id_son"; $sql.= " FROM ".MAIN_DB_PREFIX."user"; - $sql.= " WHERE fk_user != 0"; - $sql.= " AND entity = ".$conf->entity; + $sql.= " WHERE fk_user <> 0"; + $sql.= " AND entity IN (".getEntity('user',1).")"; dol_syslog(get_class($this)."::load_parentof sql=".$sql); $resql = $this->db->query($sql); @@ -2237,7 +2237,7 @@ class User extends CommonObject // Init this->parentof that is array(id_son=>id_parent, ...) $this->load_parentof(); - + // Init $this->users array $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.login, u.statut, u.entity"; // Distinct reduce pb with old tables with duplicates $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; @@ -2326,13 +2326,13 @@ class User extends CommonObject // Define fullpath and fullname $this->users[$id_user]['fullpath'] = '_'.$id_user; - $this->users[$id_user]['fullname'] = $this->users[$id_user]['label']; + $this->users[$id_user]['fullname'] = $this->users[$id_user]['lastname']; $i=0; $cursor_user=$id_user; - while ((empty($protection) || $i < $protection) && ! empty($this->parentof[$cursor_user])) + while ((empty($protection) || $i < $protection) && ! empty($this->parentof[$cursor_user])) // Loop on each parent, one after one { $this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath']; - $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['label'].' >> '.$this->users[$id_user]['fullname']; + $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'].' >> '.$this->users[$id_user]['fullname']; $i++; $cursor_user=$this->parentof[$cursor_user]; } -- GitLab