diff --git a/application/controllers/RechercheController.php b/application/controllers/RechercheController.php index 12e74704b..d5809e10d 100644 --- a/application/controllers/RechercheController.php +++ b/application/controllers/RechercheController.php @@ -313,22 +313,25 @@ class RechercheController extends Zend_Controller_Action $listParams = array('siret', 'actNomRs', 'cpVille', 'pays', 'cpVille', 'pctMin', 'pctMax'); break; } - $nbField = count($listParams); - foreach($listParams as $key){ - if(!empty($params[$key])){ - $params[$key] = strip_tags($params[$key]); - $nbField--; - } - } - - if ($nbField!=0){ - $this->_forward($action, 'recherche'); - } $rechercheParams = new RechercheHistorique(); //Si le formulaire a été soumis alors on enregistre en session et on redirige - if ( !empty($type) ) { + if ( !empty($type) ) { + //Vérification si au moins un champs a été saisie + $nbField = count($listParams); + foreach($listParams as $key){ + if(!empty($params[$key])){ + $params[$key] = strip_tags($params[$key]); + } else { + $nbField--; + } + } + if ($nbField==0){ + $this->_redirect('/recherche/'.$action); + } + + //Redirection $token = $rechercheParams->save($type, $params); $this->_redirect('recherche/liste/token/'.$token); }