SD-21 Correction des appels surnuméraires au webservice + export excel

des conso
This commit is contained in:
Claire DELBOS 2017-03-21 16:14:55 +01:00
parent 3d565b7d96
commit 9aca193415
10 changed files with 105 additions and 36 deletions

View File

@ -224,6 +224,22 @@ class Achatclient_IndexController extends Zend_Controller_Action
echo $user->getSiret();die;
}
public function consocsvAction(){
//Validation
$request = $this->getRequest();
$user = new Scores_Utilisateur();
$ok=$user->checkperm($this->libdroits);
if(!$ok){
$this->error('paiement', __LINE__);
}
$ws = new Scores_Ws_Client('credit', '0.1');
$infos = $ws->mensuelconsoCredit();
header('X-Sendfile: consommation.tsv');
header('Content-Type: application/csv-tab-delimited-table');
header('Content-Disposition: attachment; filename="consommation.tsv"');
echo $this->view->partial('index/consocsv.phtml',$infos);
die;
}
private function sendContact($data,$user){
//@todo: envoyer le mail

View File

@ -0,0 +1,28 @@
fonction<?php echo chr(9); ?>login<?php echo chr(9); ?>nb_credit<?php echo chr(9); ?>siren<?php echo chr(9); ?>date<?php echo chr(10); ?>
<?php foreach($this->used as $row):
foreach($row->item as $obj):
?><?php
if($obj->key=='idLog'){
if(isset($this->libelle[$obj->value]))
{echo $this->libelle[$obj->value];}
else{echo $obj->value;}
echo chr(9);
}
if($obj->key=='login'){
echo $obj->value;
echo chr(9);
}
if($obj->key=='consumption'){
echo $obj->value;
echo chr(9);
}
if($obj->key=='created'){
echo Date('d/m/Y H:i:s',strtotime($obj->value));
echo chr(10);
}
if($obj->key=='siret'){
echo substr($obj->value,0,9);
echo chr(9);
}
?>
<?php endforeach;endforeach;?>

View File

@ -66,9 +66,9 @@ Une remarque ? <a href="<?=$this->url(array('controller'=>'index', 'action'=>'co
</table>
<?php endif;?>
<?php if(isset($this->infos) && isset($this->infos['used'])):?>
<h2>Historique de vos consommations</h2>
<h2>Historique de vos consommations <a href="<?=$this->url(array('controller'=>'index', 'action'=>'consocsv'))?>" alt="Télécharger l'historique" title="Télécharger l'historique"><img src="/themes/default/images/menu/downloadcsv.jpg" width="20px" alt="Télécharger l'historique" title="Télécharger l'historique"></a></h2>
<table class="data" style="max-width:90%;">
<tr><th></th><th>Date d'utilisation</th><th>Nb Crédits</th><th>Fonctionnalité utilisée</th></tr>
<tr><th></th><th>Date d'utilisation</th><th>Nb Crédits</th><th>Fonctionnalité utilisée</th><th>Siren</th></tr>
<?php foreach($this->infos['used'] as $row):?>
<tr><td></td>
<td><?=Date('d/m/Y H:i:s',strtotime($row['created']))?></td>
@ -76,7 +76,9 @@ Une remarque ? <a href="<?=$this->url(array('controller'=>'index', 'action'=>'co
<td><?php
if(isset($this->infos['libelle'][$row['idLog']]))
{echo $this->infos['libelle'][$row['idLog']];}
else{echo $row['idLog'];}?></td>
else{echo $row['idLog'];}?>
</td>
<td class="nbr"><?=substr($row['siret'],0,9)?></td>
</tr>
<?php endforeach;?>
</table>

View File

@ -37,13 +37,16 @@ class DirigeantController extends Zend_Controller_Action
$siren = substr($this->siret, 0, 9);
$ws = new WsScores();
if (empty($autrePage)) {
$this->view->headTitle()->prepend('Liste des dirigeants');
$this->view->headTitle()->prepend('Siret '.$this->siret);
}else{
$ws->freeService=true;
}
$ws = new WsScores();
$infos = $ws->getDirigeants($siren);
$ws->freeService=false;
if ($infos === false){
$this->forward('soap', 'error');

View File

@ -279,15 +279,15 @@ class EvaluationController extends Zend_Controller_Action
$entreprise = new Scores_Session_Entreprise($this->siret, $this->id);
//@todo : transformer le webservice pour ne faire qu'une seule requete
$ws = new WsScores();
$ws->freeService=true;
$indiscore = $ws->getIndiScore($siren, 0, 1);
if ($indiscore === false) {
$indiscore = $ws->getIndiScore($siren, 0, 4);
$ws->freeService=true;
if ($indiscore === false) {
$this->forward('soap', 'error');
}
$identite = $ws->getIdentite($siren);
$ws->freeService=false;
$infos = $ws->getRatios($siren, 'indiscore2');
if ($infos === false) $this->forward('soap', 'error');
$ws->freeService=false;
$score = array();
$tabRatio = array(

View File

@ -678,6 +678,7 @@ class IdentiteController extends Zend_Controller_Action
$this->view->assign('edition', $user->checkModeEdition());
$ws = new WsScores();
if (!empty($autrePage)) {$ws->freeService=true;}
if ($lienRef) {
@ -685,6 +686,8 @@ class IdentiteController extends Zend_Controller_Action
if (empty($autrePage)) {
$this->view->headTitle()->prepend('Liens inter-entreprises - Id '.$lienRef);
}else{
$ws->freeService=true;
}
$identite = $ws->getLienRef($lienRef);
@ -712,7 +715,7 @@ class IdentiteController extends Zend_Controller_Action
}
//Get links
$infos = $ws->getLiensById($lienRef);
$infos = $ws->getLiensById($lienRef);
} else {
$siren = substr($this->siret,0,9);
@ -762,6 +765,7 @@ class IdentiteController extends Zend_Controller_Action
$this->view->assign('civilite', $result->civilite);
$this->view->assign('naissanceDate', $result->naissance_Date);
}
$ws->freeService=false;
if ( in_array($session->getFormeJuridique(), array(5488,5498,5720)) ) {
$this->view->assign('FJ1', true);

View File

@ -74,6 +74,9 @@ class JuridiqueController extends Zend_Controller_Action
$position = ($page - 1) * $nbAffichage;
$ws = new WsScores();
if(!empty($autrePage)){
$ws->freeService=true;
}
switch ($vue) {
case 'balo':
$infos = $ws->getAnnoncesBalo($siren, $idAnn, null, $position, $nbAffichage);
@ -108,6 +111,7 @@ class JuridiqueController extends Zend_Controller_Action
$infos = $ws->getAnnoncesLegales($siren, $idAnn, null, $position, $nbAffichage);
break;
}
$ws->freeService=false;
$this->logger->info(print_r($infos,1));
if ($infos === false) {
$this->forward('soap', 'error');
@ -217,6 +221,9 @@ class JuridiqueController extends Zend_Controller_Action
} else {
$this->view->assign('vue', $vue);
$ws = new WsScores();
if(!empty($autrePage)){
$ws->freeService=true;
}
switch ($vue) {
case 'balo':
$infos = $ws->getAnnoncesBalo($siren, $idAnn, null, $position, $nbAffichage);

View File

@ -9,6 +9,10 @@ return array(
'debug' => true,
'errorMsg' => array('MSG'),
),
'mensuelconsoCredit' => array(
'debug' => true,
'errorMsg' => array('MSG'),
),
'useCredit' => array(
'debug' => true,
'errorMsg' => array('MSG'),

View File

@ -290,7 +290,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getValo')){return false;}
if(!$this->decLog('getValo',$siren)){return false;}
return $cache->getBlock();
}
}
@ -1179,7 +1179,7 @@ class WsScores
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('interne');
if(!$this->decLog('getGroupeInfos')){return false;}
if(!$this->decLog('getGroupeInfos',$siren)){return false;}
try {
$reponse = $client->getGroupeInfos($params);
return $reponse->getGroupeInfosResult;
@ -1210,7 +1210,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
$this->decLog('getGroupesArbo');
$this->decLog('getGroupesArbo',$siren);
return $cache->getBlock();
}
}
@ -1485,7 +1485,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getRapport')){return false;}
if(!$this->decLog('getRapport',$siren)){return false;}
return $cache->getBlock();
}
}
@ -1600,7 +1600,11 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getIndiScore')){return false;}
if($niveau==4){
if(!$this->decLog('getReportSynthese',$siren)){return false;}
}else{
if(!$this->decLog('getIndiScore',$siren)){return false;}
}
return $cache->getBlock();
}
}
@ -2075,7 +2079,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getMarques')){return false;}
if(!$this->decLog('getMarques', $siren)){return false;}
return $cache->getBlock();
}
}
@ -2109,7 +2113,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getListeConventions')){return false;}
if(!$this->decLog('getListeConventions',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2144,7 +2148,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getListeCompetences')){return false;}
if(!$this->decLog('getListeCompetences',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2179,7 +2183,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getInfosReg')){return false;}
if(!$this->decLog('getInfosReg',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2239,7 +2243,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getAnnoncesBalo')){return false;}
if(!$this->decLog('getAnnoncesBalo',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2275,7 +2279,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getAnnoncesBoamp')){return false;}
if(!$this->decLog('getAnnoncesBoamp',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2315,7 +2319,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getAnnoncesAsso')){return false;}
if(!$this->decLog('getAnnoncesAsso',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2347,7 +2351,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getAnnoncesLegales')){return false;}
if(!$this->decLog('getAnnoncesLegales',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2388,7 +2392,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
$this->decLog('getAnnonces');
$this->decLog('getAnnonces',$siren);
return $cache->getBlock();
}
}
@ -2485,7 +2489,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getListeBilans')){return false;}
if(!$this->decLog('getListeBilans',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2520,7 +2524,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getBilan')){return false;}
if(!$this->decLog('getBilan',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2555,7 +2559,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getBanques')){return false;}
if(!$this->decLog('getBanques',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2587,7 +2591,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getInfosBourse')){return false;}
if(!$this->decLog('getInfosBourse',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2624,7 +2628,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('get'.ucfirst($page))){return false;}
if(!$this->decLog('get'.ucfirst($page),$siren)){return false;}
return $cache->getBlock();
}
}
@ -2659,7 +2663,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getDirigeants')){return false;}
if(!$this->decLog('getDirigeants',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2824,7 +2828,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getIdentite')){return false;}
if(!$this->decLog('getIdentite',$siret)){return false;}
return $cache->getBlock();
}
}
@ -2863,7 +2867,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getIdentiteProcol')){return false;}
if(!$this->decLog('getIdentiteProcol',$siret)){return false;}
return $cache->getBlock();
}
}
@ -2935,7 +2939,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getLiens')){return false;}
if(!$this->decLog('getLiens',$siren)){return false;}
return $cache->getBlock();
}
}
@ -2975,7 +2979,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getListeEvenements')){return false;}
if(!$this->decLog('getListeEvenements',$siren)){return false;}
return $cache->getBlock();
}
}
@ -3015,7 +3019,7 @@ class WsScores
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
if(!$this->decLog('getListeEtablissements')){return false;}
if(!$this->decLog('getListeEtablissements',$siren)){return false;}
return $cache->getBlock();
}
}
@ -3432,12 +3436,13 @@ class WsScores
}
}
}
private function decLog($idLog){
private function decLog($idLog,$siren='extranet'){
if(!$this->freeService){
$wsc = new Scores_Ws_Client('credit', '0.1');
$params = new stdClass();
$params->idLog = $idLog;
$infocredit = $wsc->useCredit($params);
$params->siren = $siren;
$infocredit = $wsc->useCredit($params);
return $infocredit->result;
}
return $this->freeService;

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B