diff --git a/application/controllers/ArborescenceController.php b/application/controllers/ArborescenceController.php index eb8381a9..91bfb901 100644 --- a/application/controllers/ArborescenceController.php +++ b/application/controllers/ArborescenceController.php @@ -61,6 +61,7 @@ class ArborescenceController extends Zend_Controller_Action $request = $this->getRequest(); $key = $request->getParam('key'); + $parent = $request->getParam('parent'); $niveau = $request->getParam('niveau', 1); $niveau = $niveau + 1; @@ -80,7 +81,6 @@ class ArborescenceController extends Zend_Controller_Action } } - $niveau++; $nafM = new Application_Model_Naf(); $sql = $nafM->select(); @@ -89,8 +89,8 @@ class ArborescenceController extends Zend_Controller_Action } elseif (!empty($parent) && $niveau>2) { $sql->where("code LIKE '".$parent."%'"); } - $sql->where('niveau = ?', $niveau)->order('code ASC'); - + $sql->where('niveau = ?', $niveau)->order('code ASC'); + $result = $nafM->fetchAll($sql)->toArray(); $tabNaf = array(); foreach($result as $item){