Skip to content
Snippets Groups Projects
Commit 69888aa5 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: get_full_tree was not working correctly.

parent 1239e713
No related branches found
No related tags found
No related merge requests found
......@@ -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];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment