From 136f9623be1c6a302e41c323a5927fcb42fe47f5 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Tue, 31 Jul 2012 15:10:51 +0000 Subject: [PATCH] Search by code postal and use code insee as code --- application/controllers/FieldsController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/application/controllers/FieldsController.php b/application/controllers/FieldsController.php index 28992a2f..eb8e7ee6 100644 --- a/application/controllers/FieldsController.php +++ b/application/controllers/FieldsController.php @@ -24,7 +24,7 @@ class FieldsController extends Zend_Controller_Action $request = $this->getRequest(); $family = $request->getParam('family'); - if (!empty($family) ) + if ( !empty($family) ) { $fields = new Scores_Fields(); $fields->resetFamille($family); @@ -67,7 +67,7 @@ class FieldsController extends Zend_Controller_Action $q = preg_replace("/['-]/", ' ', $q); //Remove characters - $q = preg_replace("/^[a-z0-9]\s/i", '', $q); + $q = preg_replace("/^[a-z]\s/i", '', $q); //Detect if we have string if ( preg_match("/[a-zA-Z]+/", $q) ) @@ -157,12 +157,13 @@ class FieldsController extends Zend_Controller_Action $result = $table->fetchAll($sql); foreach ($result as $item) { $output[] = array( - 'label' => $item->Codepos . ' ( Code postal )', - 'value' => $item->Codepos + 'label' => $item->Commune . ', '. $item->Codepos .' (Ville)', + 'value' => 'C'.$item->INSEE ); } } + break; case 'cj': $table = new Application_Model_FormeJuridique();