diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ca55cd4e839..3aee2589b32 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3349,10 +3349,11 @@ abstract class CommonObject if ($resql) { $i = 0; $num = $this->db->num_rows($resql); + $grandchild = getDolGlobalInt('MAIN_CARE_GRANDCHILD'); while ($i < $num) { $row = $this->db->fetch_row($resql); $rows[] = $row[0]; // Add parent line into array rows - $children = $this->getChildrenOfLine($row[0]); + $children = $this->getChildrenOfLine($row[0], $grandchild); if (!empty($children)) { foreach ($children as $child) { array_push($rows, $child);