From 182a6c1b8eec3ff991fdfffcc8abe9ab4e212e40 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Mon, 26 Sep 2016 11:19:06 +0200 Subject: [PATCH] Gestion erreur dans cadastre --- .../controllers/EvaluationController.php | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/application/modules/default/controllers/EvaluationController.php b/application/modules/default/controllers/EvaluationController.php index babc938c3..57bfc1a71 100644 --- a/application/modules/default/controllers/EvaluationController.php +++ b/application/modules/default/controllers/EvaluationController.php @@ -248,16 +248,19 @@ class EvaluationController extends Zend_Controller_Action $this->view->headTitle()->prepend("Siret ".$this->siret); $user = new Scores_Utilisateur(); - if(!$user->checkPerm('INDISCORE2') && !$user->checkPerm('INDISCORE2P')) + if(!$user->checkPerm('INDISCORE2') && !$user->checkPerm('INDISCORE2P')) { $this->forward('perms', 'error'); + } $siren = substr($this->siret,0,9); - + $entreprise = new Scores_Session_Entreprise($this->siret, $this->id); //@todo : transformer le webservice pour ne faire qu'une seule requete $ws = new WsScores(); - $entreprise = new Scores_Session_Entreprise($this->siret, $this->id); - $identite = $ws->getIdentite($siren); - $indiscore = $ws->getIndiScore($siren); + $indiscore = $ws->getIndiScore($siren); + if ($indiscore === false) { + $this->forward('soap', 'error'); + } + $identite = $ws->getIdentite($siren); $infos = $ws->getRatios($siren, 'indiscore2'); $score = array(); @@ -297,13 +300,11 @@ class EvaluationController extends Zend_Controller_Action $annees = array_slice($annees, 0, $nbMaxBilan); sort($annees); $tabResult = array(); - foreach($annees as $annee) - { + foreach($annees as $annee) { $data = array(); $dataEvol = array(); //Formatter les données - foreach($tabRatio as $idRatio => $valRatio) - { + foreach($tabRatio as $idRatio => $valRatio) { $data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio); $dataTotal[$idRatio] = $ratiosData->dTotal($typeBilan, $annee, $idRatio, $valRatio['total']); $dInfo[$idRatio] = $valRatio['total_info']; @@ -1053,6 +1054,9 @@ class EvaluationController extends Zend_Controller_Action try { $response = $ws->getCadastrePatrimoine($params); + if ($response === false) { + $this->forward('soap', 'error'); + } $this->view->List = $response->item; } catch (Exception $e) { $this->view->MsgTxt = $e->getMessage();