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

id_parent and id_children was not set.

So introduce new method to return same with no risk to break current
working code to address this.
parent badf3794
No related branches found
No related tags found
No related merge requests found
......@@ -2220,8 +2220,6 @@ class User extends CommonObject
* Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau
* Renvoi un tableau de tableau('id','id_parent',...) trie selon arbre et avec:
* id = id du user
* id_parent = id du user parent
* id_children = tableau des id enfant
* name = nom du user
* fullname = nom avec chemin complet du user
* fullpath = chemin complet compose des id
......@@ -2306,6 +2304,29 @@ class User extends CommonObject
return $this->users;
}
/**
* Return list of all childs users in herarchy.
*
* @return array Array of user id lower than user. This overwrite this->users.
*/
function getAllChildIds()
{
// Init this->users
$this->get_full_tree();
$idtoscan=$this->id;
$childids=array();
dol_syslog("Build childid for id = ".$idtoscan);
foreach($this->users as $id => $val)
{
//var_dump($val['fullpath']);
if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id'];
}
return $childids;
}
/**
* For user id_user and its childs available in this->users, define property fullpath and fullname
*
......
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