diff --git a/app/Models/OrgsModel.php b/app/Models/OrgsModel.php index 8b8d7d615..bd6a001f0 100755 --- a/app/Models/OrgsModel.php +++ b/app/Models/OrgsModel.php @@ -163,9 +163,9 @@ public function getDescendants($id = 0) $org_list = array(); if (empty($this->orgs)) { $sql = 'SELECT * FROM orgs'; - $this->orgs = $this->db->query($sql)->getResult(); + $orgs = $this->db->query($sql)->getResult(); } - foreach ($this->orgs as $org) { + foreach ($orgs as $org) { if (intval($org->parent_id) === $id && intval($org->id) !== 1) { $org_list[] = intval($org->id); foreach ($this->getDescendants($org->id) as $org) {