Gestion des Exceptions après retour de l'API
This commit is contained in:
parent
7a7819dffd
commit
95940ad113
@ -237,6 +237,17 @@ class JuridiqueController extends Zend_Controller_Action
|
||||
|
||||
$siren = substr($this->siret, 0,9);
|
||||
$type = $request->getParam('type', 'DF');
|
||||
$this->view->Type = $type;
|
||||
$typeList = array(
|
||||
'DE' => 'Demandeur',
|
||||
'DF' => 'Défendeur',
|
||||
);
|
||||
$this->view->TypeLabel = '';
|
||||
if (array_key_exists($type, $typeList)) {
|
||||
$this->view->TypeLabel = $typeList[$type];
|
||||
}
|
||||
$this->view->TypeList = $typeList;
|
||||
|
||||
$nbReponses = 20;
|
||||
$page = $request->getParam('page', 1);
|
||||
if ( $page <= 0 ) $page = 1;
|
||||
@ -248,39 +259,47 @@ class JuridiqueController extends Zend_Controller_Action
|
||||
$params->p = $position;
|
||||
$params->limit = $nbReponses;
|
||||
|
||||
$ws = new Scores_Ws_Client('entreprise', '0.9');
|
||||
$response = $ws->getGreffeAffaireList($params);
|
||||
try {
|
||||
$ws = new Scores_Ws_Client('entreprise', '0.9');
|
||||
$response = $ws->getGreffeAffaireList($params);
|
||||
if ($response === false) {
|
||||
$this->view->msg = "Erreur";
|
||||
} else {
|
||||
|
||||
$this->view->List = $response->List->item;
|
||||
$this->view->List = $response->List->item;
|
||||
// --- Pagination
|
||||
$nbReponsesTotal = $response->Nb;
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
$pagePrev = null;
|
||||
$pageNext = null;
|
||||
if ($nbReponses < $nbReponsesTotal) {
|
||||
$pageTotal = ceil( $nbReponsesTotal / $nbReponses );
|
||||
$pageCurrent = $page;
|
||||
$pagePrev = $page - 1;
|
||||
if ($pagePrev < 1) {
|
||||
$pagePrev = 1;
|
||||
}
|
||||
$pageNext = $page + 1;
|
||||
if( $pageNext > $pageTotal ) {
|
||||
$pageNext = $pageTotal;
|
||||
}
|
||||
}
|
||||
$this->view->assign('PageTotal', $pageTotal);
|
||||
$this->view->assign('PagePrev', $pagePrev);
|
||||
$this->view->assign('PageNext', $pageNext);
|
||||
$this->view->assign('PageCurrent', $pageCurrent);
|
||||
|
||||
$this->view->assign('nbReponses', empty($nbReponses) ? 0 : $nbReponses);
|
||||
$this->view->assign('nbReponsesTotal', empty($nbReponsesTotal) ? 0 : $nbReponsesTotal);
|
||||
|
||||
$this->view->assign('siren', $siren);
|
||||
$this->view->assign('siret', $this->siret);
|
||||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||||
|
||||
// --- Pagination
|
||||
$nbReponsesTotal = $response->Nb;
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
$pagePrev = null;
|
||||
$pageNext = null;
|
||||
if ($nbReponses < $nbReponsesTotal) {
|
||||
$pageTotal = ceil( $nbReponsesTotal / $nbReponses );
|
||||
$pageCurrent = $page;
|
||||
$pagePrev = $page - 1;
|
||||
if ($pagePrev < 1) {
|
||||
$pagePrev = 1;
|
||||
}
|
||||
$pageNext = $page + 1;
|
||||
if( $pageNext > $pageTotal ) {
|
||||
$pageNext = $pageTotal;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->view->msg = $e->getMessage();
|
||||
}
|
||||
$this->view->assign('PageTotal', $pageTotal);
|
||||
$this->view->assign('PagePrev', $pagePrev);
|
||||
$this->view->assign('PageNext', $pageNext);
|
||||
$this->view->assign('PageCurrent', $pageCurrent);
|
||||
|
||||
$this->view->assign('nbReponses', empty($nbReponses) ? 0 : $nbReponses);
|
||||
$this->view->assign('nbReponsesTotal', empty($nbReponsesTotal) ? 0 : $nbReponsesTotal);
|
||||
|
||||
$this->view->assign('siren', $siren);
|
||||
$this->view->assign('siret', $this->siret);
|
||||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||||
}
|
||||
|
||||
public function ctxdetailAction()
|
||||
@ -301,10 +320,17 @@ class JuridiqueController extends Zend_Controller_Action
|
||||
$params = new stdClass();
|
||||
$params->id = $id;
|
||||
|
||||
$ws = new Scores_Ws_Client('entreprise', '0.9');
|
||||
$response = $ws->getGreffeAffaireDetail($params);
|
||||
|
||||
$this->view->Affaire = $response;
|
||||
try {
|
||||
$ws = new Scores_Ws_Client('entreprise', '0.9');
|
||||
$response = $ws->getGreffeAffaireDetail($params);
|
||||
if ($response === false) {
|
||||
$this->view->msg = "Erreur";
|
||||
} else {
|
||||
$this->view->Affaire = $response;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->view->msg = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,7 +90,7 @@ class PiecesController extends Zend_Controller_Action
|
||||
} else {
|
||||
$this->view->ref = strtoupper($result);
|
||||
}
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->view->msg = $e->getMessage();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,15 @@
|
||||
<div id="center">
|
||||
<h1 class="titre">Contentieux Judiciaires</h1>
|
||||
|
||||
<?php if ($this->msg) {?>
|
||||
<div class="paragraph">
|
||||
<div style="padding: 0 .7em;" class="ui-state-error ui-corner-all">
|
||||
<p><span style="float: left; margin-right: .3em;" class="ui-icon ui-icon-alert"></span>
|
||||
<strong>Alert:</strong> <?=$this->msg?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php } else {?>
|
||||
|
||||
<div class="paragraph">
|
||||
<table class="identite">
|
||||
<tr>
|
||||
@ -15,7 +25,13 @@
|
||||
<tr>
|
||||
<td width="30"> </td>
|
||||
<td width="200" class="StyleInfoLib">Affaire(s) en tant que</td>
|
||||
<td width="350" class="StyleInfoData">Défendeur / Demandeur</td>
|
||||
<td width="350" class="StyleInfoData">
|
||||
<select>
|
||||
<?php foreach($this->TypeList as $k => $v) {?>
|
||||
<option value="<?=$k?>" <?php if ($k==$this->Type){?> selected<?php }?>><?=$v?></option>
|
||||
<?php }?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@ -72,5 +88,7 @@
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
<?php }?>
|
||||
|
||||
<?=$this->render('cgu.phtml', $this->cgu)?>
|
||||
</div>
|
||||
|
@ -1,5 +1,15 @@
|
||||
<div id="center">
|
||||
<h1 class="titre">Contentieux Judiciaires</h1>
|
||||
|
||||
<?php if ($this->msg) {?>
|
||||
<div class="paragraph">
|
||||
<div style="padding: 0 .7em;" class="ui-state-error ui-corner-all">
|
||||
<p><span style="float: left; margin-right: .3em;" class="ui-icon ui-icon-alert"></span>
|
||||
<strong>Alert:</strong> <?=$this->msg?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php } else {?>
|
||||
|
||||
<div class="paragraph">
|
||||
<table class="identite">
|
||||
<tr>
|
||||
@ -97,4 +107,6 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php }?>
|
||||
|
||||
</div>
|
@ -4,7 +4,7 @@
|
||||
<p><span style="float: left; margin-right: .3em;" class="ui-icon ui-icon-alert"></span>
|
||||
<strong>Alert:</strong> <?=$this->msg?></p>
|
||||
</div>
|
||||
|
||||
|
||||
<?php } else if ($this->ref) {?>
|
||||
|
||||
Votre référence : <?=strtoupper($this->ref)?>
|
||||
|
@ -142,7 +142,7 @@ class Scores_Ws_Client extends Zend_Soap_Client
|
||||
}
|
||||
|
||||
$methodConfig = $this->config[$name];
|
||||
|
||||
Zend_Registry::get('firebug')->info($methodConfig);
|
||||
// --- Cache
|
||||
$cacheEnable = false;
|
||||
if ( array_key_exists('cache', $methodConfig) ) {
|
||||
@ -197,6 +197,7 @@ class Scores_Ws_Client extends Zend_Soap_Client
|
||||
// --- Gestion des SOAP fault
|
||||
if ( array_key_exists('errorMsg', $methodConfig) ) {
|
||||
if ( in_array($fault->faultcode, $methodConfig['errorMsg']) ) {
|
||||
Zend_Registry::get('firebug')->info("Exception as error message : ".$fault->faultcode);
|
||||
throw new Exception($fault->faultstring);
|
||||
}
|
||||
}
|
||||
|
@ -3,18 +3,22 @@ return array(
|
||||
'0.9' => array(
|
||||
'getGreffeAffaireList' => array(
|
||||
'debug' => true,
|
||||
'errorMsg' => array('0902'),
|
||||
),
|
||||
'getGreffeAffaireDetail' => array(
|
||||
'debug' => true,
|
||||
'errorMsg' => array('0902'),
|
||||
),
|
||||
'getIdentite' => array(
|
||||
'debug' => true,
|
||||
),
|
||||
'getPrivilegeDetail' => array(
|
||||
'debug' => true,
|
||||
'errorMsg' => array('0902'),
|
||||
),
|
||||
'getPrivilegeList' => array(
|
||||
'debug' => true,
|
||||
'errorMsg' => array('0902'),
|
||||
),
|
||||
'getRNVP' => array(
|
||||
'debug' => true,
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user