NEW get all child recursively
This commit is contained in:
parent
b8ea58f18c
commit
d2a364eea8
@ -2526,9 +2526,10 @@ abstract class CommonObject
|
|||||||
* Get children of line
|
* Get children of line
|
||||||
*
|
*
|
||||||
* @param int $id Id of parent line
|
* @param int $id Id of parent line
|
||||||
|
* @param int $includealltree 0 = 1st level child, 1 = All level child
|
||||||
* @return array Array with list of children lines id
|
* @return array Array with list of children lines id
|
||||||
*/
|
*/
|
||||||
public function getChildrenOfLine($id)
|
public function getChildrenOfLine($id, $includealltree = 0)
|
||||||
{
|
{
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
@ -2541,16 +2542,14 @@ abstract class CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$i = 0;
|
if($this->db->num_rows($resql) > 0) {
|
||||||
$num = $this->db->num_rows($resql);
|
while($row = $this->db->fetch_row($resql)) {
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$row = $this->db->fetch_row($resql);
|
|
||||||
$rows[$i] = $row[0];
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$rows[] = $row[0];
|
||||||
|
if (!empty($includealltree)) $rows = array_merge($rows, $this->getChildrenOfLine($row[0]), $includealltree);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user