Redirection avis de situation Insee

This commit is contained in:
Michael RICOIS 2016-03-15 16:14:46 +00:00
parent 47aa8d5120
commit 304942f6eb

View File

@ -1220,34 +1220,37 @@ class IdentiteController extends Zend_Controller_Action
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
// ==> Start
$avis = new Scores_Insee_AvisSituation($this->siret);
if (!$avis->erreur()){
$avis->erreurcpt('raz');
$body = $avis->get('pdf', 1);
if($body !== false) {
header("Pragma: public");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: must-revalidate");
header("Content-type: application/pdf");
header("Content-Length: ".strlen($body));
header('Content-disposition: inline; filename="avis-'.$this->siret.'.pdf"');
header("Accept-Ranges: ".strlen($body));
echo $body;
$ws = new WsScores();
$ws->setLog('avis_situation', $this->siret, 0, '');
} else {
$avis->erreurcpt('plus');
echo $avis->erreurmsg();
}
if (APPLICATION_ENV == 'staging' || true) {
$this->redirect('http://avis-situation-sirene.insee.fr/');
} else {
if ($avis->nberreur()==5){
$avis->mailerreur();
}
$avis->erreurcpt('plus');
echo $avis->erreurmsg();
// ==> Start
$avis = new Scores_Insee_AvisSituation($this->siret);
if (!$avis->erreur()){
$avis->erreurcpt('raz');
$body = $avis->get('pdf', 1);
if($body !== false) {
header("Pragma: public");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: must-revalidate");
header("Content-type: application/pdf");
header("Content-Length: ".strlen($body));
header('Content-disposition: inline; filename="avis-'.$this->siret.'.pdf"');
header("Accept-Ranges: ".strlen($body));
echo $body;
$ws = new WsScores();
$ws->setLog('avis_situation', $this->siret, 0, '');
} else {
$avis->erreurcpt('plus');
echo $avis->erreurmsg();
}
} else {
if ($avis->nberreur()==5){
$avis->mailerreur();
}
$avis->erreurcpt('plus');
echo $avis->erreurmsg();
}
}
}