Compare commits

...

10 Commits

Author SHA1 Message Date
potier
5eb4e10abe Merge branch 'develop' into 'master'
Develop into master : logger + avis situations staging spécifique + SD 30

See merge request !3
2017-04-13 12:43:25 +00:00
Michael RICOIS
00b22c28e5 Better debug 2017-04-13 14:23:16 +02:00
Michael RICOIS
ef3842021f Debug Level 2017-04-13 12:11:34 +02:00
Michael RICOIS
cf5d50ea2e Réorganisation du debug 2017-04-13 11:42:07 +02:00
Michael RICOIS
d047c57d67 Session avec Scores_Ws_Client 2017-04-13 11:21:10 +02:00
Michael RICOIS
4f28b3fcb8 Merge branch 'develop' of git@gitlab.factory.insight.doubletrade.com:scores/extranet.git into develop 2017-04-13 10:41:36 +02:00
Michael RICOIS
1f90b825f4 Logger : Stop only at notice 2017-04-13 10:41:18 +02:00
benoitpotier
a6be515460 Merge branch 'develop' of gitlab.factory.insight.doubletrade.com:scores/extranet into develop 2017-04-12 11:32:39 +02:00
benoitpotier
c709e9c659 suppression specificité staging 2017-04-12 11:32:28 +02:00
potier
6100b956bc Merge branch 'develop' into 'master'
Develop into master - confidentiel

See merge request !2
2017-04-03 13:44:07 +00:00
5 changed files with 99 additions and 96 deletions

View File

@ -123,9 +123,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
if (APPLICATION_ENV == 'development') { if (APPLICATION_ENV == 'development') {
$level = Logger::DEBUG; $level = Logger::DEBUG;
} else { } else {
$level = Logger::INFO; $level = Logger::NOTICE;
} }
$log->pushHandler(new StreamHandler($logFile), $level); $log->pushHandler(new StreamHandler($logFile, $level));
// Processor // Processor
$log->pushProcessor(new IntrospectionProcessor()); $log->pushProcessor(new IntrospectionProcessor());

View File

@ -124,10 +124,9 @@ class IdentiteController extends Zend_Controller_Action
); );
$datemajTexte = $dateDerMaj = ''; $datemajTexte = $dateDerMaj = '';
$datemajTexte.= '<table>'; $datemajTexte.= '<table>';
foreach ( $tabDate as $dateId => $dateLib ) { foreach ($tabDate as $dateId => $dateLib ) {
if ( isset($infos->{$dateId}) if (isset($infos->{$dateId}) && !empty($infos->{$dateId})
&& !empty($infos->{$dateId}) && $infos->{$dateId}!='0000-00-00') {
&& $infos->{$dateId}!='0000-00-00') {
if ( $dateId == 'DateMajID') { if ( $dateId == 'DateMajID') {
$date = new Zend_Date($infos->DateMajID, 'yyyy-MM-dd'); $date = new Zend_Date($infos->DateMajID, 'yyyy-MM-dd');
@ -365,10 +364,10 @@ class IdentiteController extends Zend_Controller_Action
$user = new Scores_Utilisateur(); $user = new Scores_Utilisateur();
//Pagination //Pagination
$request = $this->getRequest(); $request = $this->getRequest();
$page = $request->getParam('page', 1); $page = $request->getParam('page', 1);
if ( $page <= 0 ) $page = 1; if ( $page <= 0 ) $page = 1;
$nbAffichage = 50; $nbAffichage = 50;
$position = ($page - 1 ) * $nbAffichage; $position = ($page - 1 ) * $nbAffichage;
$ws = new WsScores(); $ws = new WsScores();
@ -391,26 +390,26 @@ class IdentiteController extends Zend_Controller_Action
} }
} }
//Calcul pagination //Calcul pagination
$nbReponses = count($infos->result->item); $nbReponses = count($infos->result->item);
$nbReponsesTotal = $infos->nbReponses; $nbReponsesTotal = $infos->nbReponses;
if ($nbReponses < $nbReponsesTotal) { if ($nbReponses < $nbReponsesTotal) {
$pageTotal = ceil( $nbReponsesTotal / $nbAffichage ); $pageTotal = ceil( $nbReponsesTotal / $nbAffichage );
$pageCurrent = $page; $pageCurrent = $page;
$pagePrev = $page - 1; $pagePrev = $page - 1;
if ($pagePrev < 1) { if ($pagePrev < 1) {
$pagePrev = 1; $pagePrev = 1;
} }
$pageNext = $page + 1; $pageNext = $page + 1;
if( $pageNext > $pageTotal ) { if( $pageNext > $pageTotal ) {
$pageNext = $pageTotal; $pageNext = $pageTotal;
} }
} else { } else {
$pageTotal = $pageCurrent = 1; $pageTotal = $pageCurrent = 1;
} }
$this->view->assign('PageTotal', $pageTotal); $this->view->assign('PageTotal', $pageTotal);
$this->view->assign('PagePrev', $pagePrev); $this->view->assign('PagePrev', $pagePrev);
$this->view->assign('PageNext', $pageNext); $this->view->assign('PageNext', $pageNext);
$this->view->assign('PageCurrent', $pageCurrent); $this->view->assign('PageCurrent', $pageCurrent);
$this->view->assign('nbEtabActif', $nbEtabActif); $this->view->assign('nbEtabActif', $nbEtabActif);
@ -699,7 +698,7 @@ class IdentiteController extends Zend_Controller_Action
$session = new Scores_Session_Entreprise($siren, null, true); $session = new Scores_Session_Entreprise($siren, null, true);
$this->view->assign('siren', $siren); $this->view->assign('siren', $siren);
$this->view->assign('siret', $session->getSiret()); $this->view->assign('siret', $session->getSiret());
$this->view->assign('isin', $session->getIsin()); $this->view->assign('isin', $session->getIsin());
$this->view->assign('surveillance', $user->checkPerm('survdirigeants')); $this->view->assign('surveillance', $user->checkPerm('survdirigeants'));
} }
@ -725,7 +724,7 @@ class IdentiteController extends Zend_Controller_Action
$this->view->assign('isin', $session->getIsin()); $this->view->assign('isin', $session->getIsin());
$this->view->assign('siren', $siren); $this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret); $this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale()); $this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('surveillance', $user->checkPerm('liens')); $this->view->assign('surveillance', $user->checkPerm('liens'));
//Check access to display group link //Check access to display group link
@ -748,18 +747,18 @@ class IdentiteController extends Zend_Controller_Action
$this->view->assign('PP', true); $this->view->assign('PP', true);
//@todo : using this function is strange - How to get the id before ? //@todo : using this function is strange - How to get the id before ?
$result = $ws->searchLienRef($siren, 'siren'); $result = $ws->searchLienRef($siren, 'siren');
if (count($result->item)>0) { if (count($result->item)>0) {
foreach ($result->item as $item) { foreach ($result->item as $item) {
$id = $item->id; $id = $item->id;
break; break;
} }
} }
$result = $ws->getLienRef($id); $result = $ws->getLienRef($id);
$this->view->assign('nom', $result->nom); $this->view->assign('nom', $result->nom);
$this->view->assign('prenom', $result->prenom); $this->view->assign('prenom', $result->prenom);
$this->view->assign('civilite', $result->civilite); $this->view->assign('civilite', $result->civilite);
$this->view->assign('naissanceDate', $result->naissance_Date); $this->view->assign('naissanceDate', $result->naissance_Date);
} }
@ -1233,55 +1232,49 @@ class IdentiteController extends Zend_Controller_Action
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
// --- En environement de preprod, on envoi sur le site
if (APPLICATION_ENV == 'staging') {
$this->redirect('http://avis-situation-sirene.insee.fr/');
}
// --- Téléchargement du fichier et distribution // --- Téléchargement du fichier et distribution
else { $avis = new Scores_Insee_AvisSituation($this->siret);
$avis = new Scores_Insee_AvisSituation($this->siret); if ( !$avis->erreur() ) {
if ( !$avis->erreur() ) { $avis->erreurcpt('raz');
$avis->erreurcpt('raz'); $file = $avis->get();
$file = $avis->get(); if ($file === false) {
if ($file === false) { $avis->erreurcpt('plus');
$avis->erreurcpt('plus'); echo $avis->erreurmsg();
echo $avis->erreurmsg(); } else {
} else { // --- Envoi du fichier sur la sortie standard
// --- Envoi du fichier sur la sortie standard $content_type = 'application/pdf';
$content_type = 'application/pdf'; if ( file_exists($file) ) {
if ( file_exists($file) ) { $ws = new WsScores();
$ws = new WsScores(); $ws->setLog('avis_situation', $this->siret, 0, '');
$ws->setLog('avis_situation', $this->siret, 0, ''); $modules = array(); //apache_get_modules();
$modules = array(); //apache_get_modules(); if (in_array('mod_xsendfile', $modules)) {
if (in_array('mod_xsendfile', $modules)) { header ('X-Sendfile: ' . $file);
header ('X-Sendfile: ' . $file); header ('Content-Type: ' . $content_type);
header ('Content-Type: ' . $content_type); header ('Content-Disposition: attachment; filename="' . $content_type . '"');
header ('Content-Disposition: attachment; filename="' . $content_type . '"'); exit;
exit;
} else {
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
} else { } else {
echo "Impossible de charger le fichier"; ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
} }
} else {
echo "Impossible de charger le fichier";
} }
} else { }
if ($avis->nberreur()==5){ } else {
$avis->mailerreur(); if ($avis->nberreur()==5){
} $avis->mailerreur();
$avis->erreurcpt('plus'); }
echo $avis->erreurmsg(); $avis->erreurcpt('plus');
} echo $avis->erreurmsg();
} }
} }
/** /**

View File

@ -123,10 +123,11 @@ class Scores_Session_Entreprise
protected function getInfoEntrep($siret, $id = 0) protected function getInfoEntrep($siret, $id = 0)
{ {
$this->logger->info('getInfoEntrep'); $ws = new Scores_Ws_Client('interne', '0.6');
require_once 'Scores/WsScores.php'; $params = new stdClass();
$ws = new WsScores(); $params->siret = $this->siret;
$etab = $ws->getIdentiteLight($siret, $id); $params->id = $this->id;
$etab= $ws->getIdentiteLight($params);
$this->setSession($etab); $this->setSession($etab);
} }

View File

@ -147,7 +147,7 @@ class Scores_Ws_Client extends Zend_Soap_Client
} }
$methodConfig = $this->config[$name]; $methodConfig = $this->config[$name];
$this->logger->info(print_r($methodConfig,1));
// --- Cache // --- Cache
$cacheEnable = false; $cacheEnable = false;
if ( array_key_exists('cache', $methodConfig) ) { if ( array_key_exists('cache', $methodConfig) ) {
@ -172,17 +172,22 @@ class Scores_Ws_Client extends Zend_Soap_Client
// --- Debug // --- Debug
if ( array_key_exists('debug', $methodConfig) ) { if ( array_key_exists('debug', $methodConfig) ) {
$this->logger->info(__CLASS__.'->'.$name); $this->logger->info(__CLASS__.'->'.$name.':'.print_r($arguments,1));
$this->logger->info(print_r($arguments,1));
} }
try { try {
$response = parent::__call($name, $arguments); $response = parent::__call($name, $arguments);
// --- Response vide
if ($response == '') {
$this->logger->error(__CLASS__.'->'.$name.':'.print_r($arguments, 1));
return false;
}
// --- Debug // --- Debug
if ( array_key_exists('debug', $methodConfig) ) { if ( array_key_exists('debug', $methodConfig) ) {
$this->logger->info(print_r($response,1)); $this->logger->info(__CLASS__.'->'.$name.':'.print_r($response,1));
} }
// --- Cache // --- Cache
@ -196,13 +201,13 @@ class Scores_Ws_Client extends Zend_Soap_Client
// --- Debug // --- Debug
if ( array_key_exists('debug', $methodConfig) ) { if ( array_key_exists('debug', $methodConfig) ) {
$this->logger->info($fault->faultcode.' - '.$fault->faultstring); $this->logger->error(__CLASS__.'->'.$name.':'.$fault->faultcode.' - '.$fault->faultstring);
} }
// --- Gestion des SOAP fault // --- Gestion des SOAP fault
if ( array_key_exists('errorMsg', $methodConfig) ) { if ( array_key_exists('errorMsg', $methodConfig) ) {
if ( in_array($fault->faultcode, $methodConfig['errorMsg']) ) { if ( in_array($fault->faultcode, $methodConfig['errorMsg']) ) {
$this->logger->info("Exception as error message : ".$fault->faultcode); $this->logger->info(__CLASS__.'->'.$name.':'." Exception as error message : ".$fault->faultcode);
throw new Exception($fault->faultstring); throw new Exception($fault->faultstring);
} }
} }

View File

@ -1,6 +1,10 @@
<?php <?php
return array( return array(
'0.6' => array( '0.6' => array(
'getIdentiteLight' => array(
'debug' => true,
'log' => 'mail',
),
'getRncsEven' => array( 'getRncsEven' => array(
'debug' => true, 'debug' => true,
'log' => 'mail', 'log' => 'mail',