Update library Scores

This commit is contained in:
Michael RICOIS 2014-04-22 14:16:46 +00:00
parent 97bc6debe9
commit 742ead7a85
36 changed files with 4968 additions and 1078 deletions

View File

@ -1,6 +1,4 @@
<?php <?php
require_once 'common/dates.php';
class Annonces class Annonces
{ {
public $annoncesBodacc = array(); public $annoncesBodacc = array();
@ -58,7 +56,7 @@ class Annonces
' du '.$this->dateAnnonce($ann->DateParution); ' du '.$this->dateAnnonce($ann->DateParution);
} else { } else {
$view = new Zend_View(); $view = new Zend_View();
$session = new SessionEntreprise(null); $session = new Scores_Session_Entreprise(null);
$href = $view->url(array( $href = $view->url(array(
'controller' => 'juridique', 'controller' => 'juridique',
'action' => 'competences', 'action' => 'competences',
@ -230,7 +228,12 @@ class Annonces
*/ */
protected function dateAnnonce($date) protected function dateAnnonce($date)
{ {
return WDate::dateT('Y-m-d', 'd/m/Y', $date); if ( $date!='' ) {
$dateS = new Zend_Date($date, 'yyyy-MM-dd');
return $dateS->toString('dd/MM/yyyy');
}
return '';
} }
protected function logoTitleAnnonce($ann) protected function logoTitleAnnonce($ann)
@ -317,7 +320,8 @@ class Annonces
$numEven = $even->CodeEven*1; $numEven = $even->CodeEven*1;
if ($numEven>3000 && $numEven<3999) { if ($numEven>3000 && $numEven<3999) {
if (isset($ann->dateEffet)){ if (isset($ann->dateEffet)){
$lib.= ' (clôture au '.WDate::dateT('Y-m-d','d/m/Y',$ann->dateEffet).')'; $date = new Zend_Date($ann->dateEffet, 'yyyy-MM-dd');
$lib.= ' (clôture au '.$date->toString('dd/MM/yyyy').')';
} }
} }
$user = new Scores_Utilisateur(); $user = new Scores_Utilisateur();
@ -339,7 +343,8 @@ class Annonces
foreach ($this->annonces as $i => $ann) foreach ($this->annonces as $i => $ann)
{ {
//Génération id pour tri //Génération id pour tri
$id = WDate::dateT('Y-m-d','Ymd',$ann->DateParution).':'.$ann->id; $date = new Zend_Date($ann->DateParution,'yyyy-MM-dd');
$id = $date->toString('yyyyMMdd').':'.$ann->id;
if ($this->isBodacc($ann->BodaccCode)){ if ($this->isBodacc($ann->BodaccCode)){
$this->annoncesBodacc[$id] = $ann; $this->annoncesBodacc[$id] = $ann;
} elseif ($this->isBalo($ann->BodaccCode)) { } elseif ($this->isBalo($ann->BodaccCode)) {
@ -356,7 +361,8 @@ class Annonces
public function getAnnee($ann) public function getAnnee($ann)
{ {
return WDate::dateT('Y-m-d','Y',$ann->DateParution); $date = new Zend_Date($ann->DateParution,'yyyy-MM-dd');
return $date->toString('yyyy');
} }
public function getNum($ann) public function getNum($ann)

View File

@ -1,151 +0,0 @@
<?php
class Scores_AuthAdapter implements Zend_Auth_Adapter_Interface
{
protected $_username;
protected $_password;
protected $_timeout = 1800;
protected $_checkIp = false;
public function __construct($username, $password, $iponly = false)
{
$this->_username = $username;
$this->_password = $password;
if ($iponly){
$this->_password = 'iponly:'.$_SERVER['REMOTE_ADDR'];
}
$this->_checkIp = $iponly;
}
public function authenticate()
{
$adressIp = $_SERVER['REMOTE_ADDR'];
require_once 'Scores/WsScores.php';
$ws = new WsScores($this->_username, $this->_password);
$InfosLogin = $ws->getInfosLogin($this->_username, $adressIp);
$identity = new stdClass();
$identity->username = $this->_username;
$identity->password = $this->_password;
$identity->email = $InfosLogin->result->email;
$identity->profil = $InfosLogin->result->profil;
$identity->pref = $InfosLogin->result->pref;
$identity->droits = $InfosLogin->result->droits;
$identity->droitsClients = $InfosLogin->result->droitsClients;
$identity->nom = $InfosLogin->result->nom;
$identity->prenom = $InfosLogin->result->prenom;
$identity->tel = $InfosLogin->result->tel;
$identity->fax = $InfosLogin->result->fax;
$identity->mobile = $InfosLogin->result->mobile;
$identity->id = $InfosLogin->result->id;
$identity->idClient = $InfosLogin->result->idClient;
$identity->reference = $InfosLogin->result->reference;
$identity->nbReponses = $InfosLogin->result->nbReponses;
$identity->typeScore = $InfosLogin->result->typeScore;
$identity->dateValidation = $InfosLogin->result->dateValidation;
$identity->nombreConnexions = $InfosLogin->result->nombreConnexions;
$identity->dateDerniereConnexion = $InfosLogin->result->dateDerniereConnexion;
$identity->dateDebutCompte = $InfosLogin->result->dateDebutCompte;
$identity->dateFinCompte = $InfosLogin->result->dateFinCompte;
$identity->acceptationCGU = $InfosLogin->result->acceptationCGU;
$identity->ip = $adressIp;
$identity->modeEdition = false;
$timeout = (!empty($InfosLogin->result->timeout)) ? $InfosLogin->result->timeout : $this->_timeout;
$identity->timeout = $timeout;
$identity->time = time() + $timeout;
$lang = in_array($InfosLogin->result->lang, array('fr','en')) ? $InfosLogin->result->lang : 'fr';
$identity->lang = $lang;
$identity->langtmp = $lang;
/*
* Adresse Ip interdites
*/
$ipInterdites =
'81.252.88.0-81.252.88.7' // CTE D AGGLOMERATION DE SOPHIA
. ';' . '195.200.187.163' // PacWan
. ';' . '213.11.81.41' // Verizon France SAS
. ';' . '83.206.171.252' // FR-BASE-D-INFORMATIONS-LEGALES-BI
. ';' . '81.255.32.139'
. ';' . '212.155.191.1*' // Satair A/S
. ';' . '217.70.1*.17' // OJSC "Sibirtelecom"
. ';' . '212.37.196.156' // GENERALE-MULTIMEDIA-SUD
. ';' . '80.245.60.121' // Planete Marseille - Mailclub
. ';' . '213.246.57.101' // IKOULA
. ';' . '193.104.158.0-193.104.158.255' // Altares.fr
. ';' . '195.6.3.0-195.6.3.255' // ORT
. ';' . '217.144.112.0-217.144.116.63' // Coface
;
if ( $this->checkPlagesIp($ipInterdites, $adressIp) ) {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity);
}
// Renvoi
if ( is_string($InfosLogin) || $InfosLogin->error->errnum!=0){
$message = $InfosLogin;
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message));
} elseif ($this->_username == $InfosLogin->result->login) {
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
} else {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity);
}
}
/**
* Controle si une adresse IP est dans une liste des IP communiquées sous la forme 192.168.3.5-192.68.3.10;192.168.3.*;192.168.3.10
* @param string $strPlageIP La plage d'adresses IP
* @param string $adresseIP L'adresse IP à tester
*/
protected function checkPlagesIp($strPlageIP, $adresseIP)
{
$connected = false;
$tabIpAllowed = explode(';', trim($strPlageIP));
if (count($tabIpAllowed)==1 && $tabIpAllowed[0]=='') $tabIpAllowed = array();
foreach ($tabIpAllowed as $ip) {
$tabPlages = explode('-', $ip);
// C'est une plage d'adresse '-'
if (isset($tabPlages[1]))
$connected = $this->in_plage($tabPlages[0],$tabPlages[1],$adresseIP);
else {
// C'est une adresse avec ou sans masque '*'
if (preg_match('/^'.str_replace('*','.*',str_replace('.','\.',$ip)).'$/', $adresseIP) )
$connected=true;
}
if ($connected) break;
}
if (count($tabIpAllowed)==0) return false;
elseif (!$connected) {
return false;
}
return true;
}
/**
* Enter description here ...
* @param unknown_type $plage_1
* @param unknown_type $plage_2
* @param unknown_type $ip
* @return boolean
*/
protected function in_plage($plage_1,$plage_2,$ip)
{
$ip2 = $this->getIpNumber($ip);
if ($ip2>=$this->getIpNumber($plage_1) && $ip2<=$this->getIpNumber($plage_2))
return true;
else
return false;
}
/**
* Converti une IP en nombre
* @param string $ip Adresse IP
* @return integer
*/
protected function getIpNumber($ip) {
$tab=explode('.', $ip);
return (($tab[0]*256*256*256) + ($tab[1]*256*256) + ($tab[2]*256) + ($tab[3]));
}
}

View File

@ -1,282 +0,0 @@
<?php
class AvisSituation
{
protected static $timeout = 10;
protected static $retryDelay = 300;
protected $fichierErreur;
protected $pathLog;
protected $pathAvisPdf;
protected $siret;
public function __construct($siret)
{
require_once 'common/curl.php';
$c = Zend_Registry::get('config');
$this->pathAvisPdf = $c->profil->path->files;
$this->pathLog = realpath($c->profil->path->data).'/log';
$this->fichierErreur = $this->pathLog.'/aviserreur.lock';
$this->siret = $siret;
}
public function erreurcpt($action)
{
switch($action){
case 'plus':
if (file_exists($this->fichierErreur)){
$handle = fopen($this->fichierErreur, 'r');
$data = fgetcsv($handle, '1000', ';');
$date_creation = $data[0];
$date_modification = time();
$nb = $data[2];
fclose($handle);
} else {
$date_creation = time();
$date_modification = time();
$nb = 0;
}
$nb++;
$handle = fopen($this->fichierErreur, 'w');
fputcsv($handle, array($date_creation, $date_modification, $nb), ';');
fclose($handle);
break;
case 'raz':
$handle = fopen($this->fichierErreur, 'w');
$date_creation = time();
$date_modification = time();
$nb = 0;
fputcsv($handle, array($date_creation, $date_modification, $nb), ';');
fclose($handle);
break;
}
}
public function nberreur()
{
if (file_exists($this->fichierErreur)){
$handle = fopen($this->fichierErreur, 'r');
$data = fgetcsv($handle, '1000', ';');
$nb = $data[2];
fclose($handle);
} else {
$nb = 1;
}
return $nb;
}
public function erreur()
{
if (file_exists($this->fichierErreur))
{
$handle = fopen($this->fichierErreur, 'r');
$data = fgetcsv($handle, '1000', ';');
$date_creation = $data[0];
$date_modification = $data[1];
$nb = $data[2];
fclose($handle);
} else {
$date_creation = 0;
$date_modification = 0;
}
if ($nb>0 && $date_modification<$date_creation+$this->retryDelay){
return true;
} else {
return false;
}
}
public function mailerreur()
{
$user = new Scores_Utilisateur();
$objet = "AVIS INSEE - (Date :".date("d")."/".date("m")."/".date("Y").")";
$texte = 'Accès impossible au site de situation INSEE : '.
$this->siret.EOL.
'http://avis-situation-sirene.insee.fr'.EOL.
'pour login '.$user->getLogin().EOL;
require_once 'Scores/Mail.php';
$mail = new Mail();
$mail->setFrom('contact');
$mail->addToKey('support');
$mail->setSubject($objet);
$mail->setBodyText($texte);
$mail->send();
}
public function erreurmsg(){
return "<h3>Le site partenaire n'a pas répondu correctement ou est indisponible. Merci d'essayer à nouveau ultérieurement.</h3>";
}
/**
* Récupére l'avis de situtation à partir du site au format pdf
* @param string $format Format 'pdf' ou 'array'
* @param boolean $force True aller obligatoirement le chercher à l'insee
* @return string Le PDF demandé
*/
public function get($format='pdf', $force=0)
{
$force=$force*1;
$date=date('Ymd');
$siren=trim(substr($this->siret,0,9));
$nic=trim(substr($this->siret,9,5));
$fichier = $this->pathAvisPdf.'/avis-'.$siren.'-'.$nic.'-'.$date.'.pdf';
if ($format!='pdf') return 'Format pdf uniquement';
if ($force==0 && file_exists($fichier))
{
// On délivre l'avis en base
return file_get_contents($fichier);
}
else
{
/** Initialisation de la session sur le site de l'Insee **/
$url = 'http://avis-situation-sirene.insee.fr/avisitu/jsp/avis.jsp';
//http://avis-situation-sirene.insee.fr/avisituV2/jsp/avis.jsp';
$referer = $cookie = '';
$page = getUrl($url, $cookie, '', $referer, false, 'avis-situation-sirene.insee.fr', '', $this->timeout);
//Code en 4xx ou 5xx signifie une erreur du serveur
$codeN = floor($page['code']/100);
if($codeN==4 || $codeN==5)
{
return false;
}
else
{
$referer = $url;
$body = $page['body'];
$serviceDispo = true;
//On doit retrouver sur la page
/*
<form name="demForm" method="post" action="/avisitu/IdentificationListeSiret.do
*/
if (preg_match("/<form name=\"demForm\" method=\"post\" action=\"\/avisitu\/IdentificationListeSiret.do/Uis", $body, $matches))
{
$fp = @fopen($fichier, "a");
@fwrite($fp, $body);
@fclose($fp);
$cookie = $page['header']['Set-Cookie'];
usleep(round(rand(500000,2000000)));
$dep=$depActif='';
if ($nic=='') $crit='S'; // l'établissement siège
else $crit=''; // établissement particulier, saisissez le NIC
/* $crit='T'; // tous les établissements de l'entreprise
$crit='T'; // tous les établissements de l'entreprise du département $dep
$crit='A'; // tous les établissements actifs de l'entreprise
$crit='A'; // tous les établissements actifs de l'entreprise du département $depActif
*/
//Post du formulaire
$url = 'http://avis-situation-sirene.insee.fr/avisitu/IdentificationListeSiret.do';
//$url='http://avis-situation-sirene.insee.fr/avisituV2/IdentificationDetailEtab.do';
$post = array(
'siren' => $siren,
'critere' => $crit, // S pour le siège ou vide avec un NIC !!!
'nic' => $nic,
'departement' => $dep,
'departement_actif' => $depActif,
'bSubmit' => 'Valider');
$page = getUrl($url, $cookie, $post, $referer, false, 'avis-situation-sirene.insee.fr', '', AVIS_TIMEOUT);
$body = $page['body'];
$fp=@fopen($fichier, "a");
@fwrite($fp, $body);
@fclose($fp);
if (preg_match("/<h3>Fiche établissement<\/h3>/Uis", $body, $matches))//<li class="ongletActif">&eacute;tablissement</li>
$tabInfos['fiche']='etab';
if (preg_match('/<div class="TitreGauche">(.*)<br\/>/Uis', $body, $matches)) {
$tabInfos['raiSoc']=trim($matches[1]);
}
if (preg_match("/Derni&egrave;re mise &agrave; jour : (.*)<\/div>/Uis", $body, $matches))
$tabInfos['dateMaj']=trim($matches[1]);
$s1=substr($siren,0,3);
$s2=substr($siren,3,3);
$s3=substr($siren,6,3);
if (preg_match('/<div class="TitreDroite">(?:.*)('.$s1.'(?:.*)'.$s2.'(?:.*)'.$s3.')(?:.*)('.$nic.')(?:.*)<\/div>/Uis', $body, $matches)) {
$tabInfos['siren'] = trim($matches[1]);
$tabInfos['nic'] = trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">Etat : <\/label>(.*)depuis le(.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['etat'] = trim($matches[1]);
$tabInfos['dateEtat']= trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">Cat&eacute;gorie d\'&eacute;tablissement : <\/label>(.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['typeEtab']= trim($matches[1]);
}
$tabAdresse=array();
if (preg_match('/<label id="labelFiche">Adresse d\'implantation : <\/label>(?:.*)<ul id="adresse">(.*)<\/ul>/Uis', $body, $matches)) {
$strTmp=trim($matches[1]);
$tabTmp=explode('</li>', $strTmp);
foreach ($tabTmp as $i=>$strTmp)
$tabAdresse[$i]=trim(str_replace('<li>','',$strTmp));
}
if (preg_match('/<label id="labelFiche">(?:.*)Catégorie juridique :(?:.*)<\/label>(.*) - (.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['fjCod']= trim($matches[1]);
$tabInfos['fjLib']= trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">Activité principale exercée :(?:.*)<\/label>(.*) - (.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['nafCod']=trim($matches[1]);
$tabInfos['nafLib']=trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">(?:.*)Tranche d&#39;effectif(.*)<\/label>(.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['effPeriode']=trim($matches[1]);
$tabInfos['effTranche']=trim($matches[2]);
}
$strCsv=$siren.';'.$nic.';'.$tabInfos['fiche'].';'.$tabInfos['dateMaj'].';'.
$tabInfos['siren'].';'.$tabInfos['nic'].';'.$tabInfos['raiSoc'].';'.
$tabInfos['etat'].';'.$tabInfos['dateEtat'].';'.$tabInfos['fjCod'].';'.$tabInfos['fjLib'].';'.
$tabInfos['nafCod'].';'.$tabInfos['nafLib'].';'.$tabInfos['effPeriode'].';'.
$tabInfos['effTranche'].';'.
$tabInfos['typeEtab'].';'.@implode(';',@$tabAdresse).
";\n";
$fp=@fopen($this->pathLog."/avis.csv", "a");
@fwrite($fp, $strCsv);
@fclose($fp);
// $body contient l'avis de situation au format html
$tabErreurs=array();
if (preg_match('/name="erreurs" value="(.*)" class="erreurText" readonly/Ui', $body, $matches1) ||
preg_match('/name="erreurs_bis" value="(.*)" class="erreurTextBis" readonly/Ui', $body, $matches2)) {
$tabErreurs[]=@$matches1[1];
$tabErreurs[]=@$matches2[1];
die('<font color="red">ERREUR '.utf8_encode(implode(' ', $tabErreurs)).'</font>'); // Gérer le retour d'une erreur
}
usleep(round(rand(500000,1000000)));
if ($format=='pdf')
{
$referer = $url;
$url = 'http://avis-situation-sirene.insee.fr/avisitu/AvisPdf.do';
//$url='http://avis-situation-sirene.insee.fr/avisituV2/AvisPdf.do';
$post = array(
'siren'=>$siren,
'nic'=>$nic,
'bSubmit'=>'Avis+de+Situation'
);
$page = getUrl($url, $cookie, $post, $referer, false, 'avis-situation-sirene.insee.fr', '', AVIS_TIMEOUT);
$body = $page['body'];
$fp = @fopen($fichier, "w");
@fwrite($fp, $body);
@fclose($fp);
} // Fin format PDF
}
else
{
$body = false;
}
return $body;
} // Fin erreur initialisation
} // Fin fichier disponible
}
}

View File

@ -1,14 +1,13 @@
<?php <?php
require_once 'common/curl.php';
class BDF class BDF
{ {
protected $host = 'http://protectel.scrypto.fr'; protected $host = 'http://protectel.scrypto.fr';
protected $page = '/iBDF/RequeteLanceur.php'; protected $page = '/iBDF/RequeteLanceur.php';
protected $filetime = 8; protected $filetime = 8;
public function __construct(){} public function __construct(){}
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- //
// enleveLiens // enleveLiens
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- //
@ -34,26 +33,29 @@ class BDF
$pos1 = $pos2; $pos1 = $pos2;
} }
} }
return $contenu; return $contenu;
} }
function bdf_loadpage($url) function bdf_loadpage($url)
{ {
$page = getUrl($url, '', '', '', false, '', '',15); try {
//Fichier non disponible $client = new Zend_Http_Client($url);
if($page['code']==408 || $page['code']==400){ $response = $client->request('GET');
if ( $response->isSuccessful() ) {
$output = $response->getBody();
} else {
$output = false;
}
} catch (Zend_Http_Client_Exception $e) {
$output = false; $output = false;
//Ecriture du fichier sur le serveur en local
}else{
$body = $page['body'];
$output = $body;
} }
$output = utf8_encode($output); $output = utf8_encode($output);
$output = preg_replace('/(.*)\<html/', '<html', $output); $output = preg_replace('/(.*)\<html/', '<html', $output);
$output = $this->bdf_removeblock($output); $output = $this->bdf_removeblock($output);
$output = $this->removeTag('html', $output, true, false); $output = $this->removeTag('html', $output, true, false);
$output = $this->removeTag('head', $output, true, false); $output = $this->removeTag('head', $output, true, false);
@ -61,27 +63,27 @@ class BDF
$output = $this->removeTag('meta', $output, false, false); $output = $this->removeTag('meta', $output, false, false);
$output = $this->removeTag('title', $output, true, true); $output = $this->removeTag('title', $output, true, true);
$output = $this->removeTag('script', $output, true, true); $output = $this->removeTag('script', $output, true, true);
//$output = changeLinkToLowerCase($output); //$output = changeLinkToLowerCase($output);
$output = $this->bdf_lien_siren($output); $output = $this->bdf_lien_siren($output);
$output = stripslashes($output); $output = stripslashes($output);
return $output; return $output;
} }
function bdf_removeblock($content) function bdf_removeblock($content)
{ {
$output = $content; $output = $content;
$output = $this->enleveLiens($output, '#nullepart'); $output = $this->enleveLiens($output, '#nullepart');
$output = $this->enleveLiens($output, 'window.print'); $output = $this->enleveLiens($output, 'window.print');
$output = str_replace('/PROTECTEL/FIBEN20110207/', $output = str_replace('/PROTECTEL/FIBEN20110207/',
$this->host.'/PROTECTEL/FIBEN20110207/', $output); $this->host.'/PROTECTEL/FIBEN20110207/', $output);
return $output; return $output;
} }
function removeTag($balise, $content, $endOfTag = true, $removeContent = true) function removeTag($balise, $content, $endOfTag = true, $removeContent = true)
{ {
if( $endOfTag ) if( $endOfTag )
@ -97,29 +99,29 @@ class BDF
} }
return $output; return $output;
} }
function changeLinkToLowerCase($content) function changeLinkToLowerCase($content)
{ {
//$pattern = "/\< *[img][^\>]*[href] *= *[\"\']{0,1}([^\"\'\ >]*)/i"; //$pattern = "/\< *[img][^\>]*[href] *= *[\"\']{0,1}([^\"\'\ >]*)/i";
$pattern = '/(\<img[^>].*?>)/ie'; $pattern = '/(\<img[^>].*?>)/ie';
$replace = "strtolower('\\1')"; $replace = "strtolower('\\1')";
$content = preg_replace($pattern,$replace,$content); $content = preg_replace($pattern,$replace,$content);
$pattern = '/(\<script[^>].*?>)/ie'; $pattern = '/(\<script[^>].*?>)/ie';
$replace = "strtolower('\\1')"; $replace = "strtolower('\\1')";
$content = preg_replace($pattern,$replace,$content); $content = preg_replace($pattern,$replace,$content);
$pattern = '/(\<link[^>].*?>)/ie'; $pattern = '/(\<link[^>].*?>)/ie';
$replace = "strtolower('\\1')"; $replace = "strtolower('\\1')";
$content = preg_replace($pattern,$replace,$content); $content = preg_replace($pattern,$replace,$content);
$pattern = '/(\<table[^>].*?>)/ie'; $pattern = '/(\<table[^>].*?>)/ie';
$replace = "strtolower('\\1')"; $replace = "strtolower('\\1')";
$content = preg_replace($pattern,$replace,$content); $content = preg_replace($pattern,$replace,$content);
return $content; return $content;
} }
function bdf_lien_module($id, $service = 'fiben', $req = '', $rech = array() ) function bdf_lien_module($id, $service = 'fiben', $req = '', $rech = array() )
{ {
$func_module = 'bdf_modules_'.$service; $func_module = 'bdf_modules_'.$service;
@ -131,7 +133,7 @@ class BDF
${$key} = $val; ${$key} = $val;
} }
} }
//Paramètres URL //Paramètres URL
foreach($modules[$id]['params'] as $mparams => $fparams) foreach($modules[$id]['params'] as $mparams => $fparams)
{ {
@ -144,7 +146,7 @@ class BDF
$func_params[] = ${$fparam}; $func_params[] = ${$fparam};
} }
} }
$addParams = call_user_func_array(array($this,'bdf_param_'.$mparams), $func_params); $addParams = call_user_func_array(array($this,'bdf_param_'.$mparams), $func_params);
//Rassemblement de tout les paramètres //Rassemblement de tout les paramètres
$params = array_merge($params, $addParams); $params = array_merge($params, $addParams);
@ -158,51 +160,51 @@ class BDF
} }
return $this->host.$this->page.'?'.$output; return $this->host.$this->page.'?'.$output;
} }
function bdf_lien_siren($c) function bdf_lien_siren($c)
{ {
$p = '/(width="160" class="clFond".*)([0-9]{3} [0-9]{3} [0-9]{3} [0-9]{5})/'; $p = '/(width="160" class="clFond".*)([0-9]{3} [0-9]{3} [0-9]{3} [0-9]{5})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>'; $r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c); $c = preg_replace($p, $r, $c);
$p = '/(class="clGrasFond".*)([0-9]{3} [0-9]{3} [0-9]{3})/'; $p = '/(class="clGrasFond".*)([0-9]{3} [0-9]{3} [0-9]{3})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>'; $r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c); $c = preg_replace($p, $r, $c);
$p = '/(width="130" class="clFond".*)([0-9]{3} [0-9]{3} [0-9]{3})/'; $p = '/(width="130" class="clFond".*)([0-9]{3} [0-9]{3} [0-9]{3})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>'; $r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c); $c = preg_replace($p, $r, $c);
$p = '/(class="clFond" width="80".*)([0-9]{3} [0-9]{3} [0-9]{3})/'; $p = '/(class="clFond" width="80".*)([0-9]{3} [0-9]{3} [0-9]{3})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>'; $r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c); $c = preg_replace($p, $r, $c);
$p = '/(class="clTexte" width="184".*)([0-9]{3} [0-9]{3} [0-9]{3})/'; $p = '/(class="clTexte" width="184".*)([0-9]{3} [0-9]{3} [0-9]{3})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>'; $r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c); $c = preg_replace($p, $r, $c);
$p = '/(class="clFond" width="255".*)([0-9]{3} [0-9]{3} [0-9]{3})/'; $p = '/(class="clFond" width="255".*)([0-9]{3} [0-9]{3} [0-9]{3})/';
$r = '$1<a href="./?page=identite&siret=$2">$2</a>'; $r = '$1<a href="./?page=identite&siret=$2">$2</a>';
$c = preg_replace($p, $r, $c); $c = preg_replace($p, $r, $c);
$c = stripslashes($c); $c = stripslashes($c);
return $c; return $c;
} }
function bdf_lien_clebdf() function bdf_lien_clebdf()
{ {
//Détection des clebdf //Détection des clebdf
//Remplacement du lien //Remplacement du lien
} }
function bdf_lien_plusinfos() function bdf_lien_plusinfos()
{ {
} }
function bdf_param_banque() function bdf_param_banque()
{ {
return array( return array(
@ -210,7 +212,7 @@ class BDF
'Guichet' => '00001', 'Guichet' => '00001',
); );
} }
function bdf_param_utilisateur() function bdf_param_utilisateur()
{ {
return array( return array(
@ -218,73 +220,73 @@ class BDF
'MDP' => '', //$_SESSION['tabInfo']['password'] 'MDP' => '', //$_SESSION['tabInfo']['password']
); );
} }
function bdf_param_profil() function bdf_param_profil()
{ {
return array( return array(
'Profil' => 'Agence', 'Profil' => 'Agence',
); );
} }
function bdf_param_service($service = 'FIBEN') function bdf_param_service($service = 'FIBEN')
{ {
return array( return array(
'Service' => strtoupper($service), 'Service' => strtoupper($service),
); );
} }
function bdf_param_req($req) function bdf_param_req($req)
{ {
return array( return array(
'Req' => $req, 'Req' => $req,
); );
} }
function bdf_param_typeop($id) function bdf_param_typeop($id)
{ {
return array( return array(
'TypeOp' => $id, 'TypeOp' => $id,
); );
} }
function bdf_param_denom($denom) function bdf_param_denom($denom)
{ {
return array( return array(
'Denom' => $denom, 'Denom' => $denom,
); );
} }
function bdf_param_type($type) function bdf_param_type($type)
{ {
return array( return array(
'Type' => $type, 'Type' => $type,
); );
} }
function bdf_param_code($code) function bdf_param_code($code)
{ {
return array( return array(
'Code' => $code, 'Code' => $code,
); );
} }
function bdf_param_rechet($rechet) function bdf_param_rechet($rechet)
{ {
if(empty($rechet)) $output = 'N'; if(empty($rechet)) $output = 'N';
else $output = 'O'; else $output = 'O';
return array( return array(
'RechEt' => $output, 'RechEt' => $output,
); );
} }
function bdf_param_ape($ape) function bdf_param_ape($ape)
{ {
return array( return array(
'APE' => $ape, 'APE' => $ape,
); );
} }
function bdf_modules_fiben() function bdf_modules_fiben()
{ {
return array( return array(
@ -590,11 +592,11 @@ class BDF
), ),
'liste' => false, 'liste' => false,
), ),
); );
} }
function bdf_modules_fcc() function bdf_modules_fcc()
{ {
return array( return array(
@ -621,9 +623,9 @@ class BDF
), ),
), ),
); );
} }
function bdf_modules_ficp() function bdf_modules_ficp()
{ {
return array( return array(
@ -640,7 +642,7 @@ class BDF
), ),
); );
} }
function bdf_filetimeover($fichier) function bdf_filetimeover($fichier)
{ {
$timeover = false; $timeover = false;
@ -650,7 +652,7 @@ class BDF
if($now>$maxTime) $timeover = true; if($now>$maxTime) $timeover = true;
return $timeover; return $timeover;
} }
function displayModule($req, $module, $service, $listModules) function displayModule($req, $module, $service, $listModules)
{ {
//Vérifier que le module existe //Vérifier que le module existe
@ -663,16 +665,16 @@ class BDF
'rechet' => $rechet, 'rechet' => $rechet,
'ape' => $ape, 'ape' => $ape,
); );
$url = $this->bdf_lien_module($module, $service, $req, $rech); $url = $this->bdf_lien_module($module, $service, $req, $rech);
if($module=='07'){ if($module=='07'){
$filename = false; $filename = false;
} else { } else {
$c = Zend_Registry::get('config'); $c = Zend_Registry::get('config');
$filename = $c->profil->path->cache.'/bdf_'.$service.'_'.$req.'_'.$module.'.html'; $filename = $c->profil->path->cache.'/bdf_'.$service.'_'.$req.'_'.$module.'.html';
} }
//@todo : Ajouter timeover //@todo : Ajouter timeover
$content = ''; $content = '';
if( $filename!==false && file_exists($filename) ) { if( $filename!==false && file_exists($filename) ) {
@ -688,5 +690,5 @@ class BDF
} }
return false; return false;
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
class ExportCSV class Scores_Export_ArrayCsv
{ {
protected $entete = array(); protected $entete = array();
protected $enteteKey = array(); protected $enteteKey = array();

View File

@ -1,5 +1,5 @@
<?php <?php
class PagePrint class Scores_Export_Print
{ {
protected $controller = null; protected $controller = null;
protected $action = null; protected $action = null;
@ -11,6 +11,7 @@ class PagePrint
'identite-liens' => 'siret,id', 'identite-liens' => 'siret,id',
'identite-groupe' => 'siret', 'identite-groupe' => 'siret',
'identite-evenements' => 'siret,id', 'identite-evenements' => 'siret,id',
'identite-contacts' => 'siret,id,get,filter',
'dirigeant-liste' => 'siret,id', 'dirigeant-liste' => 'siret,id',
'dirigeant-histo' => 'siret,id', 'dirigeant-histo' => 'siret,id',
'finance-synthese' => 'siret,id,typeBilan', 'finance-synthese' => 'siret,id,typeBilan',
@ -30,11 +31,11 @@ class PagePrint
'evaluation-valorisation' => 'siret,id', 'evaluation-valorisation' => 'siret,id',
'pieces-bilans' => 'siret,id', 'pieces-bilans' => 'siret,id',
'pieces-actes' => 'siret,id', 'pieces-actes' => 'siret,id',
'giant-full' => 'Pays,Type,CompanyId', 'giant-full' => 'Pays,Type,CompanyId,Language',
'giant-compact' => 'Pays,Type,CompanyId', 'giant-compact' => 'Pays,Type,CompanyId,Language',
'giant-creditrecommendation' => 'Pays,Type,CompanyId', 'giant-creditrecommendation' => 'Pays,Type,CompanyId,Language',
'surveillance-fichier' => 'nomFic,filtre', 'surveillance-fichier' => 'nomFic,filtre',
'worldcheck-matchcontent' => 'matchIdentifier', 'worldcheck-matchcontent' => 'matchIdentifier,nameType',
); );
protected $pagePDF = array( protected $pagePDF = array(
@ -44,6 +45,7 @@ class PagePrint
'identite-liens' => 'siret,id', 'identite-liens' => 'siret,id',
'identite-groupe' => 'siret', 'identite-groupe' => 'siret',
'identite-evenements' => 'siret,id', 'identite-evenements' => 'siret,id',
'identite-contacts' => 'siret,id,get,filter',
'dirigeant-liste' => 'siret,id', 'dirigeant-liste' => 'siret,id',
'dirigeant-histo' => 'siret,id', 'dirigeant-histo' => 'siret,id',
'finance-synthese' => 'siret,id,typeBilan', 'finance-synthese' => 'siret,id,typeBilan',
@ -63,10 +65,10 @@ class PagePrint
'evaluation-valorisation' => 'siret,id', 'evaluation-valorisation' => 'siret,id',
'pieces-bilans' => 'siret,id', 'pieces-bilans' => 'siret,id',
'pieces-actes' => 'siret,id', 'pieces-actes' => 'siret,id',
'giant-full' => 'Pays,Type,CompanyId', 'giant-full' => 'Pays,Type,CompanyId,Language',
'giant-compact' => 'Pays,Type,CompanyId', 'giant-compact' => 'Pays,Type,CompanyId,Language',
'giant-creditrecommendation' => 'Pays,Type,CompanyId', 'giant-creditrecommendation' => 'Pays,Type,CompanyId,Language',
'worldcheck-matchcontent' => 'matchIdentifier', 'worldcheck-matchcontent' => 'matchIdentifier,nameType',
); );
protected $pageXML = array( protected $pageXML = array(
@ -75,6 +77,7 @@ class PagePrint
'identite-etablissements' => 'siret,id,actif', 'identite-etablissements' => 'siret,id,actif',
'identite-liens' => 'siret,id', 'identite-liens' => 'siret,id',
'identite-evenements' => 'siret,id', 'identite-evenements' => 'siret,id',
'identite-contacts' => 'siret,id,get,filter',
'dirigeant-liste' => 'siret,id', 'dirigeant-liste' => 'siret,id',
'dirigeant-histo' => 'siret,id', 'dirigeant-histo' => 'siret,id',
'finance-synthese' => 'siret,id,typeBilan', 'finance-synthese' => 'siret,id,typeBilan',
@ -91,7 +94,10 @@ class PagePrint
'evaluation-indiscore2' => 'siret,id', 'evaluation-indiscore2' => 'siret,id',
'evaluation-indiscore3' => 'siret,id', 'evaluation-indiscore3' => 'siret,id',
'evaluation-valorisation' => 'siret,id', 'evaluation-valorisation' => 'siret,id',
'worldcheck-matchcontent' => 'matchIdentifier', 'giant-full' => 'Pays,Type,CompanyId,Language',
'giant-compact' => 'Pays,Type,CompanyId,Language',
'giant-creditrecommendation' => 'Pays,Type,CompanyId,Language',
'worldcheck-matchcontent' => 'matchIdentifier,nameType',
); );
public function __construct($controller, $action) public function __construct($controller, $action)

View File

@ -32,26 +32,31 @@ class Scores_Finance_Liasse
'source' => $data->SOURCE, 'source' => $data->SOURCE,
); );
$postesData = array();
foreach ( $data->POSTES->item as $element ) {
$postesData[$element->id] = $element->val;
}
//Transformation Simplifié en Normal
if ( $data->CONSOLIDE == 'S'){
$postesData = $this->bilanSimplifie2Normal($postesData);
}
//Affectaction des postes //Affectaction des postes
foreach ($data->POSTES->item as $element){ foreach ($postesData as $id => $val){
if (in_array($element->id, array( if (in_array($element->id, array(
'YP', 'YP1', '376', // Effectifs 2033 et 2050 'YP', 'YP1', '376', // Effectifs 2033 et 2050
'M2G', 'M2H', // Autres effectifs 'M2G', 'M2H', // Autres effectifs
'ZK', 'ZK1', // Taux 'ZK', 'ZK1', // Taux
'IJ', 'JG', 'JH', 'JJ', 'ZR', // pour holding/ste mere 'IJ', 'JG', 'JH', 'JJ', 'ZR', // pour holding/ste mere
'XP' //numero de centre de gestion agréé 'XP' // numero de centre de gestion agréé
))) )))
{ {
$this->postes[$element->id] = number_format($element->val, 0, '', ' '); $this->postes[$id] = number_format($val, 0, '', ' ');
} else { } else {
$this->postes[$element->id] = $this->dMontant($element->val); $this->postes[$id] = $this->dMontant($val);
} }
} }
//Transformation Simplifié en Normal
if ( $data->CONSOLIDE == 'S'){
$this->postes = $this->bilanSimplifie2Normal($this->postes);
}
} }
public function getInfo($key) public function getInfo($key)
@ -72,115 +77,245 @@ class Scores_Finance_Liasse
function bilanSimplifie2Normal($bilanRS) function bilanSimplifie2Normal($bilanRS)
{ {
$tabBS2BN = array( $tabBS2BN = array(
'AH'=>'010', //2033 ACTIF PASSIF
'AI'=>'012', 'AH' => '010',
'AI1'=>'013', 'AI' => '012',
'AJ'=>'014', 'AI1' => '013',
'AK'=>'016', 'AI2' => 'N00',
'AK1'=>'017',
'AT'=>'028',
'AU'=>'030',
'AU1'=>'031',
'BH'=>'040',
'BI'=>'042',
'BI1'=>'043',
'BJ'=>'044',
'BK'=>'048',
'BK1'=>'049',
'BL'=>'050',
'BM'=>'052',
'BM1'=>'053',
'BT'=>'060',
'BU'=>'062',
'BU1'=>'063',
'BV'=>'064',
'BW'=>'066',
'BW1'=>'067',
'BX'=>'068',
'BY'=>'070',
'BY1'=>'071',
'BZ'=>'072',
'CA'=>'074',
'CA1'=>'075',
'CD'=>'080',
'CE'=>'082',
'CE1'=>'083',
'CF'=>'084',
'CG'=>'086',
'CG1'=>'087',
'CH'=>'092',
'CI'=>'094',
'CI1'=>'095',
'CJ'=>'096',
'CK'=>'098',
'CK1'=>'099',
'CO'=>'110',
'1A'=>'112',
'1A1'=>'113',
'DA'=>'120',
'DC'=>'124',
'DD'=>'126',
'DF'=>'130',
'DG'=>'132',
'DH'=>'134',
'DI'=>'136',
'DK'=>'140',
'DL'=>'142',
'DR'=>'154',
'DP'=>'154',
'DU'=>'156',
'DV'=>'169',
'DW'=>'164',
'DX'=>'166',
'EA'=>'172-169',
'EB'=>'174',
'EC'=>'176',
'EE'=>'180',
'EH'=>'156-195',
'FA'=>'210-209',
'FB'=>'209',
'FC'=>'210',
'FD'=>'214-215',
'FE'=>'215',
'FF'=>'214',
'FH'=>'217',
'FI'=>'218',
'FK'=>'209+215+217',
'FL'=>'210+214+218',
'FM'=>'222',
'FN'=>'224',
'FO'=>'226',
'FQ'=>'230',
'FR'=>'232',
'FS'=>'234',
'FT'=>'236',
'FU'=>'238',
'FV'=>'240',
'FW'=>'242',
'FX'=>'244',
'FY'=>'250',
'FZ'=>'252',
'GA'=>'254',
'GE'=>'262',
'GF'=>'264',
'GG'=>'270',
'GP'=>'280',
'GU'=>'294',
'GW'=>'270+280+294',
'HD'=>'290',
'HH'=>'300',
'HI'=>'290-300',
'HK'=>'306',
'HL'=>'232+280+290',
'HM'=>'264+294+300+306',
'HN'=>'310',
'YY'=>'374',
'YZ'=>'378',
'YP'=>'376',
//@todo : Traiter N-1 'AJ' => '014',
'AK' => '016',
'AK1' => '017',
'AK2' => 'N01',
'AT' => '028',
'AU' => '030',
'AU1' => '031',
'AU2' => 'N02',
'BH' => '040',
'BI' => '042',
'BI1' => '043',
'BI2' => 'N03',
'BJ' => '044',
'BK' => '048',
'BK1' => '049',
'BK2' => 'N04',
'BL' => '050',
'BM' => '052',
'BM1' => '053',
'BM2' => 'N05',
'BT' => '060',
'BU' => '062',
'BU1' => '063',
'BU2' => 'N06',
'BV' => '064',
'BW' => '066',
'BW1' => '067',
'BW2' => 'N07',
'BX' => '068',
'BY' => '070',
'BY1' => '071',
'BY2' => 'N08',
'BZ' => '072',
'CA' => '074',
'CA1' => '075',
'CA2' => 'N09',
'CD' => '080',
'CE' => '082',
'CE1' => '083',
'CE2' => 'N10',
'CF' => '084',
'CG' => '086',
'CG1' => '087',
'CG2' => 'N11',
'CH' => '092',
'CI' => '094',
'CI1' => '095',
'CI2' => 'N13',
'CJ' => '096',
'CK' => '098',
'CK1' => '099',
'CK2' => 'N14',
'CO' => '110',
'1A' => '112',
'1A1' => '113',
'1A2' => 'N15',
'DA' => '120',
'DA1' => 'N16',
'DC' => '124',
'DC1' => 'N17',
'DD' => '126',
'DD1' => 'N18',
'DF' => '130',
'DF1' => 'N19',
'DG' => '132',
'DG1' => 'N20',
'DH' => '134',
'DH1' => 'N21',
'DI' => '136',
'DI1' => 'N22',
'DK' => '140',
'DK1' => 'N23',
'DL' => '142',
'DL1' => 'N24',
'DR' => '154',
'DR1' => 'N25',
'DU' => '156',
'DU1' => 'N26',
'DW' => '164',
'DW1' => 'N27',
'DX' => '166',
'DX1' => 'N28',
'EA' => '172',
'EA1' => 'N29',
'EB' => '174',
'EB1' => 'N30',
'EC' => '176',
'EC1' => 'N31',
'EE' => '180',
'EE1' => 'N32',
'EH' => '156-195',
//2033 CDR
'FA' => '210-209',
'FB' => '209',
'FC' => '210',
'FC1' => 'N33',
'FD' => '214-215',
'FE' => '215',
'FF' => '214',
'FF1' => 'N34',
'FG' => '218-217',
'FH' => '217',
'FI' => '218',
'FI1' => 'N35',
'FJ' => '210+214+218-209-215-217',
'FK' => '209+215+217',
'FL' => '210+214+218',
'FL1' => 'N33+N34+N35',
'FM' => '222',
'FM1' => 'N36',
'FN' => '224',
'FN1' => 'N37',
'FO' => '226',
'FO1' => 'N38',
'FQ' => '230',
'FQ1' => 'N39',
'FR' => '232',
'FR1' => 'N40',
'FS' => '234',
'FS1' => 'N41',
'FT' => '236',
'FT1' => 'N42',
'FU' => '238',
'FU1' => 'N43',
'FV' => '240',
'FV1' => 'N44',
'FW' => '242',
'FW1' => 'N45',
'FX' => '244',
'FX1' => 'N46',
'FY' => '250',
'FY1' => 'N47',
'FZ' => '252',
'FZ1' => 'N48',
'GA' => '254',
'GA1' => 'N49',
'GE' => '262',
'GE1' => 'N51',
'GF' => '264',
'GF1' => 'N52',
'GG' => '270',
'GG1' => 'N53',
'GP' => '280',
'GP1' => 'N54',
'GU' => '294',
'GU1' => 'N56',
'GV' => '280-294', //GP-GU
'GV1' => 'N54-N56', //GP1-GU1
'GW' => '270+280+294', //GG+GH-GI+GV ???
'GW1' => 'N53+N54+N56',
'HD' => '290',
'HD1' => 'N55',
'HH' => '300',
'HH1' => 'N57',
'HI' => '290-300',
'HI1' => 'N55-N57',
'HK' => '306',
'HK1' => 'N58',
'HL' => '232+280+290',
'HL1' => 'N40+N54+N55',
'HM' => '264+294+300+306',
'HM1' => 'N52+N56+N57+N58',
'HN' => '310',
'HN1' => 'N59',
'YY' => '374',
'YZ' => '378',
'YP' => '376',
); );
$bilanRN=array(); $bilanRN=array();
@ -206,7 +341,7 @@ class Scores_Finance_Liasse
} }
else $bilanRN[$posteRN]=$bilanRS[$formule]; else $bilanRN[$posteRN]=$bilanRS[$formule];
} }
if ($bilanRS['240']<>0) { if ( $bilanRS['240']<>0 ) {
$bilanRN['BL']=$bilanRS['050']; $bilanRN['BL']=$bilanRS['050'];
$bilanRN['BM']=$bilanRS['052']; $bilanRN['BM']=$bilanRS['052'];
} else { } else {
@ -214,22 +349,31 @@ class Scores_Finance_Liasse
$bilanRN['BO']=$bilanRS['052']; $bilanRN['BO']=$bilanRS['052'];
} }
if ($bilanRS['070']<>0 || $bilanRS['074']<>0 || $bilanRS['052']<>0 || $bilanRS['062']<>0) if ( $bilanRS['070']<>0 || $bilanRS['074']<>0 || $bilanRS['052']<>0 || $bilanRS['062']<>0 ) {
$bilanRN['GC']=$bilanRS['256']; $bilanRN['GC']=$bilanRS['256'];
elseif ($bilanRS['070']==0 && $bilanRS['074']==0 && $bilanRS['052']==0 && $bilanRS['062']==0 && $bilanRS['254']<>0) } elseif ($bilanRS['070']==0 && $bilanRS['074']==0 && $bilanRS['052']==0 && $bilanRS['062']==0 && $bilanRS['254']<>0 ) {
$bilanRN['GD']=$bilanRS['256']; $bilanRN['GD']=$bilanRS['256'];
}
if ($bilanRS['584']<>0) { if ( $bilanRS['071']<>0 || $bilanRS['075']<>0 || $bilanRS['053']<>0 || $bilanRS['063']<>0 ) {
$bilanRN['GC1']=$bilanRS['N50'];
} elseif ($bilanRS['071']==0 || $bilanRS['075']==0 || $bilanRS['053']==0 || $bilanRS['063']==0 && $bilanRS['N49']<>0 ) {
$bilanRN['GD1']=$bilanRS['N50'];
}
if ( $bilanRS['584']<>0 ) {
$bilanRN['HB']=$bilanRS['584']; $bilanRN['HB']=$bilanRS['584'];
$bilanRN['HA']=$bilanRS['290']-$bilanRS['584']; $bilanRN['HA']=$bilanRS['290']-$bilanRS['584'];
} else } else {
$bilanRN['HA']=$bilanRS['290']; $bilanRN['HA']=$bilanRS['290'];
}
if ($bilanRS['582']<>0) { if ( $bilanRS['582']<>0 ) {
$bilanRN['HF']=$bilanRS['582']; $bilanRN['HF']=$bilanRS['582'];
$bilanRN['HE']=$bilanRS['582']-$bilanRS['300']; $bilanRN['HE']=$bilanRS['582']-$bilanRS['300'];
} else } else {
$bilanRN['HE']=$bilanRS['300']; $bilanRN['HE']=$bilanRS['300'];
}
return $bilanRN; return $bilanRN;
} }

View File

@ -1,9 +1,9 @@
<?php <?php
class Google class Scores_Google_Maps
{ {
protected $url = 'http://maps.google.fr/maps?f=q&hl=fr&geocode=&q='; protected $url = 'http://maps.google.fr/maps?f=q&hl=fr&geocode=&q=';
protected $urlPhoto = ''; protected $urlPhoto = '';
public function getGoogleKey($domain) public function getGoogleKey($domain)
{ {
switch ($domain) { switch ($domain) {
@ -25,7 +25,7 @@ class Google
break; break;
} }
} }
protected function supprDecimales($dec) protected function supprDecimales($dec)
{ {
if ($dec>0 ) if ($dec>0 )
@ -33,7 +33,7 @@ class Google
else else
return ceil($dec); return ceil($dec);
} }
public function dec2dms($dec) public function dec2dms($dec)
{ {
$d = $this->supprDecimales($dec); $d = $this->supprDecimales($dec);
@ -42,9 +42,9 @@ class Google
$m = abs($m); $m = abs($m);
return $d.'°'.$m."'".$s.'"'; return $d.'°'.$m."'".$s.'"';
} }
public function getGoogleMapLink($q) public function getGoogleMapLink($q)
{ {
return $this->url.$q; return $this->url.$q;
} }
} }

View File

@ -22,7 +22,7 @@ class Scores_Google_Streetview
/** /**
* GPS ou Adresse * GPS ou Adresse
* @var strign * @var string
*/ */
protected $location = null; protected $location = null;
@ -53,7 +53,7 @@ class Scores_Google_Streetview
/** /**
* Indicates the compass heading of the camera (0 to 360) * Indicates the compass heading of the camera (0 to 360)
*/ */
protected $heading = 0; protected $heading = null;
/** /**
* Number of image by the circle (360°) * Number of image by the circle (360°)
@ -74,14 +74,51 @@ class Scores_Google_Streetview
/** /**
* *
* @var string
*/ */
public function __construct() protected $siret;
/**
* Maximum request per day
* @var int
*/
protected $maxRequestPerDay = 25000;
/**
*
* @var unknown
*/
protected $mode;
/**
* Mode GPS
* @var unknown
*/
const MODE_GPS = 1;
/**
* Mode Adresse
* @var unknown
*/
const MODE_ADDRESS = 2;
/**
* Google Streetview
* Get image by GPS coord or by adresse
* Save image reference in a database
* GpsLat, GpsLong, Adresse, Image, Date
* Save request that give no imagery
* Siren, Nic, Date
* Save in database, with a counter the number of request by day
*/
public function __construct($siret)
{ {
$this->size = '320x320'; $this->size = '320x320';
$c = Zend_Registry::get('config'); $this->siret = $siret;
$ths->path = realpath($c->profil->path->data).'/google/streetview';
$c = Zend_Registry::get('config');
$this->path = realpath($c->profil->path->data).'/google/streetview';
} }
/** /**
@ -91,18 +128,23 @@ class Scores_Google_Streetview
*/ */
public function setLocationGeo($lattitude, $longitude) public function setLocationGeo($lattitude, $longitude)
{ {
$this->mode = self::MODE_GPS;
$this->location = $lattitude.','.$longitude; $this->location = $lattitude.','.$longitude;
} }
/** /**
* *
* @param unknown $adresse * @param string $adresse
*/ */
public function setLocationTxt($adresse){} public function setLocationTxt($adresse)
{
$this->mode = self::MODE_ADDRESS;
$this->location = $adresse;
}
/** /**
* *
* @param unknown $num * @param int $num
*/ */
public function setHeading($num) public function setHeading($num)
{ {
@ -127,7 +169,7 @@ class Scores_Google_Streetview
} }
/** /**
* * Construct the image URL
* @return string * @return string
*/ */
public function urlImg() public function urlImg()
@ -137,7 +179,7 @@ class Scores_Google_Streetview
$params = array( 'size', 'location', 'fov', 'pitch', 'sensor', 'heading' ); $params = array( 'size', 'location', 'fov', 'pitch', 'sensor', 'heading' );
foreach ($params as $param) { foreach ($params as $param) {
if ( $this->{$param} !== null ) { if ( $this->{$param} !== null ) {
$url.= '&'.$param.'='. $this->{$param}; $url.= '&'.$param.'='. urlencode($this->{$param});
} }
} }
@ -149,12 +191,19 @@ class Scores_Google_Streetview
*/ */
public function getImg() public function getImg()
{ {
require_once 'common/curl.php'; try {
$page = getUrl($this->url, '', '', '', false); $client = new Zend_Http_Client($this->url);
$client->setStream();
if ( !in_array($page['code'], array(400, 408, 403)) ) { $response = $client->request('GET');
$body = $page['body']; if ( $response->isSuccessful() ) {
file_put_contents($this->pathImg(), $body); if (!copy($response->getStreamName(), $this->pathImg())) {
Zend_Registry::get('firebug')->info('Erreur copie image !');
return false;
}
}
} catch (Zend_Http_Client_Exception $e) {
Zend_Registry::get('firebug')->info('HTTP Exception : '.$e->getMessage());
return false;
} }
} }
@ -164,7 +213,11 @@ class Scores_Google_Streetview
*/ */
public function pathImg() public function pathImg()
{ {
$filename = $this->siret.'-'.$this->heading . '.' . $this->extension; if ($this->mode == self::MODE_GPS) {
$filename = $this->siret.'-'.$this->heading . '.' . $this->extension;
} else if ($this->mode == self::MODE_ADDRESS) {
$filename = $this->siret.'-ADDRESS' . $this->extension;
}
return $this->path . DIRECTORY_SEPARATOR . $filename; return $this->path . DIRECTORY_SEPARATOR . $filename;
} }
@ -172,14 +225,33 @@ class Scores_Google_Streetview
* *
* @return string * @return string
*/ */
public function display() public function serveUrl()
{ {
return $this->urlImg();
}
/**
*
* @return string
*/
public function serveImg()
{
$this->url = $this->urlImg();
Zend_Registry::get('firebug')->info('URL = '.$file);
$file = $this->pathImg(); $file = $this->pathImg();
if ( !file_exists($file) ) { Zend_Registry::get('firebug')->info('Filename = '.$file);
$this->getImg(); $imgExist = false;
if ( !file_exists($file) && APPLICATION_ENV == 'production' ) {
$imgExist = $this->getImg();
} elseif (file_exists($file)) {
$imgExist = true;
} }
return basename($file); if ($imgExist) {
return basename($file);
}
return false;
} }
} }

View File

@ -11,7 +11,6 @@ class IdentiteEntreprise
*/ */
public function __construct($identite) public function __construct($identite)
{ {
require_once 'common/dates.php';
$this->identite = $identite; $this->identite = $identite;
$this->view = new Zend_View(); $this->view = new Zend_View();
} }
@ -110,7 +109,7 @@ class IdentiteEntreprise
public function getCapitalisationLabel() public function getCapitalisationLabel()
{ {
return 'Capitalisation'; return 'Capitalisation boursière';
} }
public function getCapitalisationTexte() public function getCapitalisationTexte()
{ {
@ -118,8 +117,9 @@ class IdentiteEntreprise
if ($this->identite->Isin == '' || intval($capitalisation) == 0) if ($this->identite->Isin == '' || intval($capitalisation) == 0)
return false; return false;
return number_format($capitalisation, 0, '', ' ').' &euro; au '. $date = new Zend_Date($this->identite->Bourse->derCoursDate, 'yyyy-MM-dd');
WDate::dateT('Y-m-d', 'd/m/Y', $this->identite->Bourse->derCoursDate);
return number_format($capitalisation, 0, '', ' ').' &euro; au '.$date->toString('dd/MM/yyyy');
} }
public function getNumRCLabel() public function getNumRCLabel()
@ -217,8 +217,8 @@ class IdentiteEntreprise
if( $this->identite->Actif != 0) { if( $this->identite->Actif != 0) {
//Activité économique //Activité économique
if (!empty($this->identite->ActifEcoDate)) { if (!empty($this->identite->ActifEcoDate)) {
$title.= "Absence d'activité économique depuis le ". $date = new Zend_Date($this->identite->ActifEcoDate, 'yyyyMMdd');
WDate::dateT('Ymd', 'd/m/Y', $this->identite->ActifEcoDate)."<br/>"; $title.= "Absence d'activité économique depuis le ".$date->toString('dd/MM/yyyy')."<br/>";
} }
//Activité economique type //Activité economique type
@ -226,17 +226,26 @@ class IdentiteEntreprise
case 'NPAI': case 'NPAI':
$title.= '<img src="/themes/default/images/interfaces/icone_courrier.png"/>'; $title.= '<img src="/themes/default/images/interfaces/icone_courrier.png"/>';
$title.= ' NPAI '; $title.= ' NPAI ';
if (!empty($this->identite->ActifEcoDate)) $title.= ' depuis le '.WDate::dateT('Ymd', 'd/m/Y', $this->identite->ActifEcoDate); if (!empty($this->identite->ActifEcoDate)) {
$date = new Zend_Date($this->identite->ActifEcoDate, 'yyyyMMdd');
$title.= ' depuis le '.$date->toString('dd/MM/yyyy');
}
$title.= '<br/>'; $title.= '<br/>';
break; break;
case 'PFER': case 'PFER':
$title.= 'Etablisement présumé fermé'; $title.= 'Etablisement présumé fermé';
if (!empty($this->identite->ActifEcoDate)) $title.= ' depuis le '.WDate::dateT('Ymd', 'd/m/Y', $this->identite->ActifEcoDate); if (!empty($this->identite->ActifEcoDate)) {
$date = new Zend_Date($this->identite->ActifEcoDate, 'yyyyMMdd');
$title.= ' depuis le '.$date->toString('dd/MM/yyyy');
}
$title.= '<br/>'; $title.= '<br/>';
break; break;
case 'ECOF': case 'ECOF':
$title.= 'Cessation économique'; $title.= 'Cessation économique';
if (!empty($this->identite->ActifEcoDate)) $title.= ' depuis le '.WDate::dateT('Ymd', 'd/m/Y', $this->identite->ActifEcoDate); if (!empty($this->identite->ActifEcoDate)) {
$date = new Zend_Date($this->identite->ActifEcoDate, 'yyyyMMdd');
$title.= ' depuis le '.$date->toString('dd/MM/yyyy');
}
$title.= '<br/>'; $title.= '<br/>';
break; break;
} }
@ -244,15 +253,16 @@ class IdentiteEntreprise
//Ancien siege //Ancien siege
if (!empty($this->identite->AncienSiegeDateFin)){ if (!empty($this->identite->AncienSiegeDateFin)){
$title.= "Cet établissement était le siège social jusqu'au ". $date = new Zend_Date($this->identite->AncienSiegeDateFin, 'yyyyMMdd');
WDate::dateT('Ymd', 'd/m/Y', $this->identite->AncienSiegeDateFin)."<br/>"; $title.= "Cet établissement était le siège social jusqu'au ".$date->toString('dd/MM/yyyy')."<br/>";
} }
if (count($this->identite->AutreSiret->item)>0){ if (count($this->identite->AutreSiret->item)>0){
//Prédécesseur //Prédécesseur
foreach($this->identite->AutreSiret->item as $pre){ foreach($this->identite->AutreSiret->item as $pre){
if ($pre->type == 'pre'){ if ($pre->type == 'pre'){
if (!empty($pre->dateEve)) { if (!empty($pre->dateEve)) {
$title.= "Avant le ".WDate::dateT('Ymd', 'd/m/Y', $pre->dateEve).", "; $date = new Zend_Date($pre->dateEve, 'yyyyMMdd');
$title.= "Avant le ".$date->toString('dd/MM/yyyy').", ";
} }
$adresse = ''; $adresse = '';
for($i=1;$i<=7;$i++){ for($i=1;$i<=7;$i++){
@ -276,7 +286,8 @@ class IdentiteEntreprise
if ($suc->type == 'suc'){ if ($suc->type == 'suc'){
$title.= "Cet établissement a déménagé "; $title.= "Cet établissement a déménagé ";
if (!empty($suc->dateEve)) { if (!empty($suc->dateEve)) {
$title.= "le ".WDate::dateT('Ymd', 'd/m/Y', $suc->dateEve)." "; $date = new Zend_Date($suc->dateEve, 'yyyyMMdd');
$title.= "le ".$date->toString('dd/MM/yyyy')." ";
} }
$adresse = ''; $adresse = '';
for($i=1;$i<=7;$i++){ for($i=1;$i<=7;$i++){
@ -317,7 +328,8 @@ class IdentiteEntreprise
} }
if ($this->identite->Actif==0 && $this->identite->DateClotEt != '') { if ($this->identite->Actif==0 && $this->identite->DateClotEt != '') {
$data.= "<i>&nbsp;(Fin d'activité en ".WDate::dateT('Ymd', 'm/Y', $this->identite->DateClotEt).')</i>'; $date = new Zend_Date($this->identite->DateClotEt, 'yyyyMMdd');
$data.= "<i>&nbsp;(Fin d'activité en ".$date->toString('dd/MM/yyyy').')</i>';
} }
$user = new Scores_Utilisateur(); $user = new Scores_Utilisateur();
@ -339,7 +351,8 @@ class IdentiteEntreprise
if ( in_array(substr($this->identite->SituationJuridique,0,1), array('P', 'R')) ) { if ( in_array(substr($this->identite->SituationJuridique,0,1), array('P', 'R')) ) {
$dateRad = ''; $dateRad = '';
if($this->identite->DateRadiation!='' && $this->identite->DateRadiation!='0000-00-00'){ if($this->identite->DateRadiation!='' && $this->identite->DateRadiation!='0000-00-00'){
$dateRad = WDate::dateT('Ymd', 'd/m/Y', str_replace('-','',$this->identite->DateRadiation)); $date = new Zend_Date(str_replace('-','',$this->identite->DateRadiation),'yyyyMMdd');
$dateRad = $date->toString('dd/MM/yyyy');
} }
//Procédure collective //Procédure collective
if ($this->identite->SituationJuridique=='PL') { if ($this->identite->SituationJuridique=='PL') {
@ -411,7 +424,7 @@ class IdentiteEntreprise
public function getRaisonSocialeLabel() public function getRaisonSocialeLabel()
{ {
return 'Raison Sociale'; return 'Dénomination Sociale';
} }
public function getRaisonSocialeTexte() public function getRaisonSocialeTexte()
{ {
@ -428,7 +441,7 @@ class IdentiteEntreprise
} }
public function getRaisonSocialeAide() public function getRaisonSocialeAide()
{ {
return "Raison sociale / Nom de l'entreprise (format court avec abréviations)"; return "Dénomination sociale / Nom de l'entreprise (format court avec abréviations)";
} }
public function getNomCommercialLabel() public function getNomCommercialLabel()
@ -491,8 +504,8 @@ class IdentiteEntreprise
$data = $this->identite->FJ.' : '.$this->identite->FJ_Lib; $data = $this->identite->FJ.' : '.$this->identite->FJ_Lib;
if ($this->identite->FJ!=$this->identite->FJ2 && if ($this->identite->FJ!=$this->identite->FJ2 &&
$this->identite->FJ2!='' && $this->identite->FJ2_Lib!='') { $this->identite->FJ2!='' && $this->identite->FJ2_Lib!='') {
$data.= '<img src="/themes/default/images/interfaces/exclamation.png" title="Forme jurique à l\'INSEE : '. $data.= '<span class="ui-icon ui-icon-info" title="Forme jurique à l\'INSEE : '.
$this->identite->FJ2_Lib.' ('.$this->identite->FJ2.')"/>'; $this->identite->FJ2_Lib.' ('.$this->identite->FJ2.')" style="float:right; margin-right: .3em;"></span>';
} }
return $data; return $data;
} }
@ -506,7 +519,9 @@ class IdentiteEntreprise
if (empty($this->identite->DateImmat) || $this->identite->DateImmat=='0000-00-00') { if (empty($this->identite->DateImmat) || $this->identite->DateImmat=='0000-00-00') {
return false; return false;
} }
return WDate::dateT('Y-m-d', 'd/m/Y',$this->identite->DateImmat);
$date = new Zend_Date($this->identite->DateImmat, 'yyyy-MM-dd');
return $date->toString('dd/MM/yyyy');
} }
public function getDateCreaEnLabel() public function getDateCreaEnLabel()
@ -516,10 +531,14 @@ class IdentiteEntreprise
public function getDateCreaEnTexte() public function getDateCreaEnTexte()
{ {
$dateCreationEn = str_replace('-', '', $this->identite->DateCreaEn); $dateCreationEn = str_replace('-', '', $this->identite->DateCreaEn);
if (substr($dateCreationEn, -2) * 1 == 0) { if ( $dateCreationEn!='' ) {
$data = WDate::dateT('Ymd', 'm/Y', $dateCreationEn); if (substr($dateCreationEn, -2) * 1 == 0) {
} else { $date = new Zend_Date($dateCreationEn, 'yyyyMMdd');
$data = WDate::dateT('Ymd', 'd/m/Y', $dateCreationEn); $data = $date->toString('MM/yyyy');
} else {
$date = new Zend_Date($dateCreationEn, 'yyyyMMdd');
$data = $date->toString('dd/MM/yyyy');
}
} }
return $data; return $data;
} }
@ -532,12 +551,13 @@ class IdentiteEntreprise
{ {
$dateCreationEt = str_replace('-', '', $this->identite->DateCreaEt); $dateCreationEt = str_replace('-', '', $this->identite->DateCreaEt);
if ($dateCreationEt * 1 <> 0) { if ($dateCreationEt * 1 <> 0) {
$date = new WDate(); if (substr($dateCreationEt, -2) * 1 == 0) {
if (substr($dateCreationEt, -2) * 1 == 0) { $date = new Zend_Date($dateCreationEt, 'yyyyMMdd');
$data = $date->dateT('Ymd', 'm/Y', $dateCreationEt); $data = $date->toString('MM/yyyy');
} else { } else {
$data = $date->dateT('Ymd', 'd/m/Y', $dateCreationEt); $date = new Zend_Date($dateCreationEt, 'yyyyMMdd');
} $data = $date->toString('dd/MM/yyyy');
}
} else { } else {
$data = 'N/C'; $data = 'N/C';
} }
@ -574,9 +594,11 @@ class IdentiteEntreprise
if (!empty($this->identite->Adresse2)) { if (!empty($this->identite->Adresse2)) {
$data.= '<span>'.$this->identite->Adresse2.'</span>'; $data.= '<span>'.$this->identite->Adresse2.'</span>';
} }
$data.= '<span>';
if (intval($this->identite->CP)!=0) { if (intval($this->identite->CP)!=0) {
$data.= '<span>'.$this->identite->CP.'&nbsp;'.$this->identite->Ville.'</span>'; $data.= $this->identite->CP.'&nbsp;';
} }
$data.= $this->identite->Ville.'</span>';
if ($this->identite->Pays!='' && strtoupper(substr($this->identite->Pays,0,3))!='FRA'){ if ($this->identite->Pays!='' && strtoupper(substr($this->identite->Pays,0,3))!='FRA'){
$data.= '<span>'.$this->identite->Pays.'</span>'; $data.= '<span>'.$this->identite->Pays.'</span>';
} }
@ -588,7 +610,10 @@ class IdentiteEntreprise
case 'NPAI': case 'NPAI':
$data.= '<div>'; $data.= '<div>';
$txtNpai = 'NPAI '; $txtNpai = 'NPAI ';
if (!empty($this->identite->ActifEcoDate)) $txtNpai.= 'depuis le '.WDate::dateT('Ymd', 'd/m/Y', $this->identite->ActifEcoDate); if (!empty($this->identite->ActifEcoDate)) {
$date = new Zend_Date($this->identite->ActifEcoDate, 'yyyyMMdd');
$txtNpai.= 'depuis le '.$date->toString('dd/MM/yyyy');
}
$data.= '<img title="'.$txtNpai.'" src="/themes/default/images/interfaces/icone_courrier.png" />'; $data.= '<img title="'.$txtNpai.'" src="/themes/default/images/interfaces/icone_courrier.png" />';
$data.= '</div>'; $data.= '</div>';
break; break;
@ -670,8 +695,6 @@ class IdentiteEntreprise
public function getTelTexte() public function getTelTexte()
{ {
$data = ''; $data = '';
$data.= '<div class="txtAdresse">';
$data.= '<p>';
if (trim($this->identite->Tel)=='') if (trim($this->identite->Tel)=='')
$data.= 'N/C'; $data.= 'N/C';
@ -690,11 +713,18 @@ class IdentiteEntreprise
$adresse = substr($this->identite->Adresse,1,strlen($this->identite->Adresse)-1); $adresse = substr($this->identite->Adresse,1,strlen($this->identite->Adresse)-1);
if ($i_adr>4) break; if ($i_adr>4) break;
} }
$data.= '&nbsp;<a title="Rechercher le num&eacute;ro de t&eacute;l&eacute;phone dans l\'annuaire" target="_blank" href="http://local.search.ke.voila.fr/S/searchproxi?act=&nom='.$libNom.
'&adr='.urlencode($this->identite->Adresse). $data.= '<br/><a href="'.$this->view->url(array(
'&loc='.urlencode($this->identite->CP.' '.$this->identite->Ville). 'controller'=>'identite',
'&x=0&y=0&bhv=searchproxi&profil=enville&guidelocid=&guideregid=&guidedepid=&actid=&ke=&locid=">(Recherche annuaire)</a></p>'; 'action'=>'contacts',
$data.= '</div>'; 'siret'=>$this->identite->Siret,
'id'=>$this->identite->id), null, true).
'"/>Plus de contacts</a>';
$data.= ' - <a title="Rechercher le num&eacute;ro de t&eacute;l&eacute;phone dans l\'annuaire" target="_blank" href="http://local.search.ke.voila.fr/S/searchproxi?act=&nom='.$libNom.
'&adr='.urlencode($this->identite->Adresse).
'&loc='.urlencode($this->identite->CP.' '.$this->identite->Ville).
'&x=0&y=0&bhv=searchproxi&profil=enville&guidelocid=&guideregid=&guidedepid=&actid=&ke=&locid=">Recherche annuaire</a>';
return $data; return $data;
} }
@ -908,9 +938,9 @@ class IdentiteEntreprise
public function getCapitalLabel() public function getCapitalLabel()
{ {
$lib = 'Capital'; $lib = 'Capital social';
if ($this->identite->CapitalType == 'V') { if ($this->identite->CapitalType == 'V') {
$lib .= ' variable'; $lib = 'Capital variable';
} }
return $lib; return $lib;
} }
@ -925,7 +955,8 @@ class IdentiteEntreprise
$this->deviseText($this->identite->Bilan->Devise); $this->deviseText($this->identite->Bilan->Devise);
} }
if (!empty($this->identite->Bilan->Cloture)) { if (!empty($this->identite->Bilan->Cloture)) {
$title .= ' au '. WDate::dateT('Ymd', 'd/m/Y',$this->identite->Bilan->Cloture); $date = new Zend_Date($this->identite->Bilan->Cloture, 'yyyyMMdd');
$title .= ' au '. $date->toString('dd/MM/yyyy');
} }
return $title; return $title;
} }
@ -972,7 +1003,8 @@ class IdentiteEntreprise
$this->deviseText($this->identite->Bilan->Devise); $this->deviseText($this->identite->Bilan->Devise);
} }
if (!empty($this->identite->Bilan->Cloture)) { if (!empty($this->identite->Bilan->Cloture)) {
$title .= ' au '.WDate::dateT('Ymd', 'd/m/Y',$this->identite->Bilan->Cloture); $date = new Zend_Date($this->identite->Bilan->Cloture, 'yyyyMMdd');
$title .= ' au '.$date->toString('dd/MM/yyyy');
} }
} }
return $title; return $title;
@ -1000,7 +1032,8 @@ class IdentiteEntreprise
$dir1DateNaiss = ''; $dir1DateNaiss = '';
if ($this->identite->dir1DateNaiss != '' && if ($this->identite->dir1DateNaiss != '' &&
$this->identite->dir1DateNaiss != '0000-00-00') { $this->identite->dir1DateNaiss != '0000-00-00') {
$dir1DateNaiss = WDate::dateT('Y-m-d', 'd/m/Y',$this->identite->dir1DateNaiss); $date = new Zend_Date($this->identite->dir1DateNaiss, 'yyyy-MM-dd');
$dir1DateNaiss = $date->toString('dd/MM/yyyy');
} }
$dir1LieuNaiss = ''; $dir1LieuNaiss = '';
if ($this->identite->dir1LieuNaiss != '') { if ($this->identite->dir1LieuNaiss != '') {
@ -1009,7 +1042,8 @@ class IdentiteEntreprise
$dir2DateNaiss = ''; $dir2DateNaiss = '';
if ($this->identite->dir2DateNaiss != '' && if ($this->identite->dir2DateNaiss != '' &&
$this->identite->dir2DateNaiss != '0000-00-00') { $this->identite->dir2DateNaiss != '0000-00-00') {
$dir2DateNaiss = WDate::dateT('Y-m-d', 'd/m/Y',$this->identite->dir2DateNaiss); $date = new Zend_Date($this->identite->dir2DateNaiss, 'yyyy-MM-dd');
$dir2DateNaiss = $date->toString('dd/MM/yyyy');
} }
$dir2LieuNaiss = ''; $dir2LieuNaiss = '';
if ($this->identite->dir2LieuNaiss != '') { if ($this->identite->dir2LieuNaiss != '') {
@ -1068,7 +1102,8 @@ class IdentiteEntreprise
} }
$data.= $this->identite->Bilan->Effectif.' salarié(s) au bilan'; $data.= $this->identite->Bilan->Effectif.' salarié(s) au bilan';
if (!empty($this->identite->Bilan->Cloture)) { if (!empty($this->identite->Bilan->Cloture)) {
$data.= " cloturé le ".WDate::dateT('Ymd', 'd/m/Y',$this->identite->Bilan->Cloture); $date = new Zend_Date($this->identite->Bilan->Cloture, 'yyyyMMdd');
$data.= " cloturé le ".$date->toString('dd/MM/yyyy');
} }
} }

View File

@ -121,8 +121,14 @@ class IdentiteProcol
$output.= html_entity_decode($annonce->evenements->item[0]->LibEven); $output.= html_entity_decode($annonce->evenements->item[0]->LibEven);
$output.= '</a>'; $output.= '</a>';
if(!empty($annonce->dateJugement) && substr($annonce->dateJugement,0,4)!='0000') $output.= ', le '.WDate::dateT('Y-m-d','d/m/Y',$annonce->dateJugement); if(!empty($annonce->dateJugement) && substr($annonce->dateJugement,0,4)!='0000') {
elseif(!empty($annonce->dateEffet) && substr($annonce->dateEffet,0,4)!='0000') $output.= ', le '.WDate::dateT('Y-m-d','d/m/Y',$annonce->dateEffet); $date = new Zend_Date($annonce->dateJugement, 'yyyy-MM-dd');
$output.= ', le '.$date->toString('dd/MM/yyyy');
}
elseif(!empty($annonce->dateEffet) && substr($annonce->dateEffet,0,4)!='0000') {
$date = new Zend_Date($annonce->dateEffet, 'yyyy-MM-dd');
$output.= ', le '.$date->toString('dd/MM/yyyy');
}
$output.= ', publié au '; $output.= ', publié au ';
$tabSource=explode('-', $annonce->BodaccCode); $tabSource=explode('-', $annonce->BodaccCode);
@ -137,7 +143,10 @@ class IdentiteProcol
}else{ }else{
$output.='JAL'; $output.='JAL';
} }
if(!empty($annonce->DateParution)) $output.= ' le '.WDate::dateT('Y-m-d','d/m/Y',$annonce->DateParution); if(!empty($annonce->DateParution)) {
$date = new Zend_Date($annonce->DateParution,'yyyy-MM-dd');
$output.= ' le '.$date->toString('dd/MM/yyyy');
}
$output.= '</p>'; $output.= '</p>';
} }
} }
@ -165,11 +174,13 @@ class IdentiteProcol
$data = ''; $data = '';
if(!empty($this->procol->StatutsConst) && $this->procol->StatutsConst!='0000-00-00') if(!empty($this->procol->StatutsConst) && $this->procol->StatutsConst!='0000-00-00')
{ {
$data.= 'Constitués le '.WDate::dateT('Y-m-d', 'd/m/Y', $this->procol->StatutsConst); $date = new Zend_Date($this->procol->StatutsConst, 'yyyy-MM-dd');
$data.= 'Constitués le '.$date->toString('dd/MM/yyyy');
} }
if(!empty($this->procol->StatutsConstDepot) && $this->procol->StatutsConstDepot!='0000-00-00') if(!empty($this->procol->StatutsConstDepot) && $this->procol->StatutsConstDepot!='0000-00-00')
{ {
$data.= ' en dépôt du '.WDate::dateT('Y-m-d', 'd/m/Y', $this->procol->StatutsConstDepot); $date = new Zend_Date($this->procol->StatutsConstDepot, 'yyyy-MM-dd');
$data.= ' en dépôt du '.$date->toString('dd/MM/yyyy');
} }
if(empty($data)) return false; if(empty($data)) return false;
return $data; return $data;
@ -184,12 +195,14 @@ class IdentiteProcol
$data = ''; $data = '';
if(!empty($this->procol->StatutsModif) && $this->procol->StatutsModif!='0000-00-00') if(!empty($this->procol->StatutsModif) && $this->procol->StatutsModif!='0000-00-00')
{ {
$data.= 'Modifiés le '.WDate::dateT('Y-m-d', 'd/m/Y', $this->procol->StatutsModif); $date = new Zend_Date($this->procol->StatutsModif, 'yyyy-MM-dd');
$data.= 'Modifiés le '.$date->toString('dd/MM/yyyy');
} }
if(!empty($this->procol->StatutsModifDepot) && $this->procol->StatutsModifDepot!='0000-00-00') if(!empty($this->procol->StatutsModifDepot) && $this->procol->StatutsModifDepot!='0000-00-00')
{ {
$data.= ' en dépôt du '.WDate::dateT('Y-m-d', 'd/m/Y', $this->procol->StatutsModifDepot); $date = new Zend_Date($this->procol->StatutsModifDepot, 'yyyy-MM-dd');
$data.= ' en dépôt du '.$date->toString('dd/MM/yyyy');
} }
if(empty($data)) return false; if(empty($data)) return false;
return $data; return $data;
@ -203,8 +216,9 @@ class IdentiteProcol
{ {
if (empty($this->procol->CessionOffreDate)) return false; if (empty($this->procol->CessionOffreDate)) return false;
return 'Offres de reprises possibles jusqu\'au '. $date = new Zend_Date($this->procol->CessionOffreDate, 'yyyy-MM-dd');
WDate::DateT('Y-m-d', 'd/m/Y', $this->procol->CessionOffreDate);
return 'Offres de reprises possibles jusqu\'au '.$date->toString('dd/MM/yyyy');
} }
public function getCessionInvenDateLabel() public function getCessionInvenDateLabel()
@ -215,8 +229,9 @@ class IdentiteProcol
{ {
if (empty($this->procol->CessionInvenDate)) return false; if (empty($this->procol->CessionInvenDate)) return false;
return 'Inventaire déposé au greffe le '. $date = new Zend_Date($this->procol->CessionInvenDate, 'yyyy-MM-dd');
WDate::DateT('Y-m-d', 'd/m/Y', $this->procol->CessionInvenDate);
return 'Inventaire déposé au greffe le '.$date->toString('dd/MM/yyyy');
} }
public function getCessionDescLabel() public function getCessionDescLabel()

View File

@ -0,0 +1,292 @@
<?php
class Scores_Insee_AvisSituation
{
protected static $timeout = 10;
protected static $retryDelay = 300;
protected $fichierErreur;
protected $pathLog;
protected $pathAvisPdf;
protected $siret;
public function __construct($siret)
{
$c = Zend_Registry::get('config');
$this->pathAvisPdf = $c->profil->path->files;
$this->pathLog = realpath($c->profil->path->data).'/log';
$this->fichierErreur = $this->pathLog.'/aviserreur.lock';
$this->siret = $siret;
}
public function erreurcpt($action)
{
switch($action){
case 'plus':
if (file_exists($this->fichierErreur)){
$handle = fopen($this->fichierErreur, 'r');
$data = fgetcsv($handle, '1000', ';');
$date_creation = $data[0];
$date_modification = time();
$nb = $data[2];
fclose($handle);
} else {
$date_creation = time();
$date_modification = time();
$nb = 0;
}
$nb++;
$handle = fopen($this->fichierErreur, 'w');
fputcsv($handle, array($date_creation, $date_modification, $nb), ';');
fclose($handle);
break;
case 'raz':
$handle = fopen($this->fichierErreur, 'w');
$date_creation = time();
$date_modification = time();
$nb = 0;
fputcsv($handle, array($date_creation, $date_modification, $nb), ';');
fclose($handle);
break;
}
}
public function nberreur()
{
if (file_exists($this->fichierErreur)){
$handle = fopen($this->fichierErreur, 'r');
$data = fgetcsv($handle, '1000', ';');
$nb = $data[2];
fclose($handle);
} else {
$nb = 1;
}
return $nb;
}
public function erreur()
{
if (file_exists($this->fichierErreur))
{
$handle = fopen($this->fichierErreur, 'r');
$data = fgetcsv($handle, '1000', ';');
$date_creation = $data[0];
$date_modification = $data[1];
$nb = $data[2];
fclose($handle);
} else {
$date_creation = 0;
$date_modification = 0;
}
if ($nb>0 && $date_modification<$date_creation+$this->retryDelay){
return true;
} else {
return false;
}
}
public function mailerreur()
{
$user = new Scores_Utilisateur();
$objet = "AVIS INSEE - (Date :".date("d")."/".date("m")."/".date("Y").")";
$texte = 'Accès impossible au site de situation INSEE : '.
$this->siret.EOL.
'http://avis-situation-sirene.insee.fr'.EOL.
'pour login '.$user->getLogin().EOL;
$mail = new Scores_Mail();
$mail->setFrom('contact');
$mail->addToKey('support');
$mail->setSubject($objet);
$mail->setBodyText($texte);
$mail->send();
}
public function erreurmsg(){
return "<h3>Le site partenaire n'a pas répondu correctement ou est indisponible. Merci d'essayer à nouveau ultérieurement.</h3>";
}
/**
* Récupére l'avis de situtation à partir du site au format pdf
* @param string $format Format 'pdf' ou 'array'
* @param boolean $force True aller obligatoirement le chercher à l'insee
* @return string Le PDF demandé
*/
public function get($format='pdf', $force=0)
{
$force=$force*1;
$date=date('Ymd');
$siren=trim(substr($this->siret,0,9));
$nic=trim(substr($this->siret,9,5));
$fichier = $this->pathAvisPdf.'/avis-'.$siren.'-'.$nic.'-'.$date.'.pdf';
if ($format!='pdf') return 'Format pdf uniquement';
// On délivre l'avis en base
if ($force==0 && file_exists($fichier)) {
return file_get_contents($fichier);
}
// On télécharge le fichier sur le site
else {
$body = false;
$cookie = false;
//Initialisation de la session sur le site de l'Insee
$url = 'http://avis-situation-sirene.insee.fr/avisitu/jsp/avis.jsp';
try {
$client = new Zend_Http_Client($url);
$client->setCookieJar();
$response = $client->request('GET');
if ( $response->isSuccessful() ) {
$body = $response->getBody();
} else {
return false;
}
} catch (Zend_Http_Client_Exception $e) {
if (APPLICATION_ENV=='development') {
echo $e->getMessage();
}
return false;
}
$cookie = $client->getCookieJar();
if (preg_match("/<form name=\"demForm\" method=\"post\" action=\"\/avisitu\/IdentificationListeSiret.do/Uis", $body, $matches)) {
$dep=$depActif='';
if ($nic=='') $crit='S'; // l'établissement siège
else $crit=''; // établissement particulier, saisissez le NIC
//Post du formulaire - Liste
$url = 'http://avis-situation-sirene.insee.fr/avisitu/IdentificationListeSiret.do';
$post = array(
'siren' => $siren,
'critere' => $crit, // S pour le siège ou vide avec un NIC !!!
'nic' => $nic,
'departement' => $dep,
'departement_actif' => $depActif,
'bSubmit' => 'Valider'
);
try {
$client = new Zend_Http_Client($url);
$client->setCookieJar($cookie);
$client->setParameterPost($post);
$response = $client->request('POST');
if ( $response->isSuccessful() ) {
$body = $response->getBody();
} else {
return false;
}
} catch (Zend_Http_Client_Exception $e) {
if (APPLICATION_ENV=='development') {
echo $e->getMessage();
}
return false;
}
$cookie = $client->getCookieJar();
if (preg_match("/<h3>Fiche établissement<\/h3>/Uis", $body, $matches))//<li class="ongletActif">&eacute;tablissement</li>
$tabInfos['fiche']='etab';
if (preg_match('/<div class="TitreGauche">(.*)<br\/>/Uis', $body, $matches)) {
$tabInfos['raiSoc']=trim($matches[1]);
}
if (preg_match("/Derni&egrave;re mise &agrave; jour : (.*)<\/div>/Uis", $body, $matches))
$tabInfos['dateMaj']=trim($matches[1]);
$s1=substr($siren,0,3);
$s2=substr($siren,3,3);
$s3=substr($siren,6,3);
if (preg_match('/<div class="TitreDroite">(?:.*)('.$s1.'(?:.*)'.$s2.'(?:.*)'.$s3.')(?:.*)('.$nic.')(?:.*)<\/div>/Uis', $body, $matches)) {
$tabInfos['siren'] = trim($matches[1]);
$tabInfos['nic'] = trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">Etat : <\/label>(.*)depuis le(.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['etat'] = trim($matches[1]);
$tabInfos['dateEtat']= trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">Cat&eacute;gorie d\'&eacute;tablissement : <\/label>(.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['typeEtab']= trim($matches[1]);
}
$tabAdresse=array();
if (preg_match('/<label id="labelFiche">Adresse d\'implantation : <\/label>(?:.*)<ul id="adresse">(.*)<\/ul>/Uis', $body, $matches)) {
$strTmp=trim($matches[1]);
$tabTmp=explode('</li>', $strTmp);
foreach ($tabTmp as $i=>$strTmp)
$tabAdresse[$i]=trim(str_replace('<li>','',$strTmp));
}
if (preg_match('/<label id="labelFiche">(?:.*)Catégorie juridique :(?:.*)<\/label>(.*) - (.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['fjCod']= trim($matches[1]);
$tabInfos['fjLib']= trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">Activité principale exercée :(?:.*)<\/label>(.*) - (.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['nafCod']=trim($matches[1]);
$tabInfos['nafLib']=trim($matches[2]);
}
if (preg_match('/<label id="labelFiche">(?:.*)Tranche d&#39;effectif(.*)<\/label>(.*)<\/p>/Uis', $body, $matches)) {
$tabInfos['effPeriode']=trim($matches[1]);
$tabInfos['effTranche']=trim($matches[2]);
}
$strCsv=$siren.';'.$nic.';'.$tabInfos['fiche'].';'.$tabInfos['dateMaj'].';'.
$tabInfos['siren'].';'.$tabInfos['nic'].';'.$tabInfos['raiSoc'].';'.
$tabInfos['etat'].';'.$tabInfos['dateEtat'].';'.$tabInfos['fjCod'].';'.$tabInfos['fjLib'].';'.
$tabInfos['nafCod'].';'.$tabInfos['nafLib'].';'.$tabInfos['effPeriode'].';'.
$tabInfos['effTranche'].';'.
$tabInfos['typeEtab'].';'.@implode(';',@$tabAdresse).
";\n";
$fp=fopen($this->pathLog."/avis.csv", "a");
fwrite($fp, $strCsv);
fclose($fp);
// $body contient l'avis de situation au format html
$tabErreurs=array();
if (preg_match('/name="erreurs" value="(.*)" class="erreurText" readonly/Ui', $body, $matches1)
|| preg_match('/name="erreurs_bis" value="(.*)" class="erreurTextBis" readonly/Ui', $body, $matches2)) {
$tabErreurs[]=@$matches1[1];
$tabErreurs[]=@$matches2[1];
die('<font color="red">ERREUR '.utf8_encode(implode(' ', $tabErreurs)).'</font>'); // Gérer le retour d'une erreur
}
usleep(round(rand(500000,1000000)));
// Get format PDF
if ( $format == 'pdf' ) {
$referer = $url;
$url = 'http://avis-situation-sirene.insee.fr/avisitu/AvisPdf.do';
$post = array(
'siren' => $siren,
'nic' => $nic,
'bSubmit' => 'Avis+de+Situation'
);
try {
$client = new Zend_Http_Client($url);
$client->setCookieJar($cookie);
$client->setParameterPost($post);
$response = $client->request('POST');
if ( $response->isSuccessful() ) {
$body = $response->getBody();
file_put_contents($fichier, $body);
} else {
return false;
}
} catch (Zend_Http_Client_Exception $e) {
if (APPLICATION_ENV=='development') {
echo $e->getMessage();
}
return false;
}
$cookie = $client->getCookieJar();
} // Fin format PDF
}
return $body;
} // Fin fichier disponible
}
}

View File

@ -1,19 +1,18 @@
<?php <?php
class Iris class Scores_Insee_Iris
{ {
protected static $timeout = 10; protected static $timeout = 10;
protected $pathIrisPdf; protected $pathIrisPdf;
protected $codeCommune; protected $codeCommune;
protected $erreur = ''; protected $erreur = '';
public function __construct($codeCommune) public function __construct($codeCommune)
{ {
require_once 'common/curl.php';
$c = Zend_Registry::get('config'); $c = Zend_Registry::get('config');
$this->pathIrisPdf = realpath($c->profil->path->data).'/iris'; $this->pathIrisPdf = realpath($c->profil->path->data).'/iris';
$this->codeCommune = $codeCommune; $this->codeCommune = $codeCommune;
} }
/** /**
* Récupére l'avis de situtation à partir du site au format pdf * Récupére l'avis de situtation à partir du site au format pdf
* @param string $format Format 'pdf' ou 'array' * @param string $format Format 'pdf' ou 'array'
@ -35,28 +34,25 @@ class Iris
else else
{ {
$url = 'http://www.insee.fr/fr/methodes/zonages/iris/cartes/carte_iris_'.$this->codeCommune.'.pdf'; $url = 'http://www.insee.fr/fr/methodes/zonages/iris/cartes/carte_iris_'.$this->codeCommune.'.pdf';
$referer = $cookie = ''; try {
$page = getUrl($url, $cookie, '', $referer, false, 'www.insee.fr', '', $this->timeout); $client = new Zend_Http_Client($url);
//Code en 4xx ou 5xx signifie une erreur du serveur $client->setStream();
$codeN = floor($page['code']/100); $response = $client->request('GET');
if($codeN==4 || $codeN==5 || substr($page['body'],0,4)!='%PDF') if ($response->isSuccessful() && substr($response->getBody(),0,4)=='%PDF') {
{ copy($response->getStreamName(), $fichier);
$this->erreur = "Fichier introuvable à l'insee !"; } else {
$this->erreur = "Fichier introuvable à l'insee !";
return false;
}
} catch (Zend_Http_Client_Exception $e) {
return false; return false;
} }
else
{
$fp = fopen($fichier, "w");
fwrite($fp, $page['body']);
fclose($fp);
return $page['body'];
}
} }
} }
public function erreur() public function erreur()
{ {
return $this->erreur; return $this->erreur;
} }
} }

View File

@ -6,7 +6,7 @@ class Logo
protected $isin = null; protected $isin = null;
protected $logoNom = ''; protected $logoNom = '';
protected $logoSize = ''; protected $logoSize = '';
public function __construct($siren, $isin = null) public function __construct($siren, $isin = null)
{ {
$c = Zend_Registry::get('config'); $c = Zend_Registry::get('config');
@ -14,7 +14,7 @@ class Logo
$this->siren = $siren; $this->siren = $siren;
$this->isin = $isin; $this->isin = $isin;
} }
public function affiche() public function affiche()
{ {
// Ne pas afficher le logo si il n'existe pas OU // Ne pas afficher le logo si il n'existe pas OU
@ -34,35 +34,38 @@ class Logo
} }
return ''; return '';
} }
public function getFromUrl($siteWeb) public function getFromUrl($siteWeb)
{ {
$img = false; $img = false;
require_once 'common/curl.php';
if (substr($siteWeb,-1)!='/') $siteWeb.='/'; if (substr($siteWeb,-1)!='/') $siteWeb.='/';
$arrUrl = parse_url($siteWeb); try {
$page = getUrl($siteWeb, '', '', '', false, $arrUrl['host'], '', 3); $client = new Zend_Http_Client($url);
$body = $page['body']; $response = $client->request('GET');
if (preg_match('/<img(?:.*)src=(?:"|\')((?:.*)logo(?:.*)(?:gif|png|jpg|jpeg))/Ui', $body, $matches)) { $siteBody = $response->getBody();
} catch (Zend_Http_Client_Exception $e) {
}
if (preg_match('/<img(?:.*)src=(?:"|\')((?:.*)logo(?:.*)(?:gif|png|jpg|jpeg))/Ui', $siteBody, $matches)) {
$logo = trim(strtr($matches[1],'"\'',' ')); $logo = trim(strtr($matches[1],'"\'',' '));
$urlLogo = $siteWeb.$logo; $urlLogo = $siteWeb.$logo;
$tmp = explode('.', basename($logo)); $tmp = explode('.', basename($logo));
$ext = end($tmp); $ext = end($tmp);
$page = getUrl($urlLogo, '', '', $siteWeb, false, $arrUrl['host']); try {
if($page['code']!=400) $client = new Zend_Http_Client($url);
{ $client->setStream();
$body = $page['body']; $response = $client->request('GET');
$img = $this->path.'/'.$this->siren.'.'.$ext; if ( $response->isSuccessful() ) {
$fp = fopen($img, 'a'); $img = $this->path.'/'.$this->siren.'.'.$ext;
fwrite($fp, $body); copy($response->getStreamName(), $img);
fclose($fp); chmod($img, 0755);
chmod($img, 0755); }
} } catch (Zend_Http_Client_Exception $e) {}
} }
return $img; return $img;
} }
public function exist() public function exist()
{ {
$img_ext = array('gif', 'png', 'jpg', 'jpeg'); $img_ext = array('gif', 'png', 'jpg', 'jpeg');
@ -88,8 +91,8 @@ class Logo
} }
return false; return false;
} }
function redimage($img_src,$dst_w,$dst_h) { function redimage($img_src,$dst_w,$dst_h) {
// Lit les dimensions de l'image // Lit les dimensions de l'image
$size = getimagesize($img_src); $size = getimagesize($img_src);
@ -104,9 +107,9 @@ class Logo
// Sinon teste quel redimensionnement tient dans la zone // Sinon teste quel redimensionnement tient dans la zone
elseif($test_h>$dst_h) $dst_w = $test_w; elseif($test_h>$dst_h) $dst_w = $test_w;
else $dst_h = $test_h; else $dst_h = $test_h;
// Affiche les dimensions optimales // Affiche les dimensions optimales
return "width=".$dst_w." height=".$dst_h; return "width=".$dst_w." height=".$dst_h;
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
class Mail class Scores_Mail
{ {
protected $config; protected $config;
protected $mail; protected $mail;

View File

@ -1,39 +1,39 @@
<?php <?php
class Mappy class Mappy
{ {
protected $login = 'scoresdecisions'; protected $login = 'scoresdecisions';
protected $password = 'g1nq3iKv'; protected $password = 'g1nq3iKv';
protected $villes = array( protected $villes = array(
'BORDEAUX', 'BORDEAUX',
'CAEN' , 'CAEN' ,
'CANNES', 'CANNES',
'GRENOBLE', 'GRENOBLE',
'LA BAULE', 'LA BAULE',
'LILLE', 'LILLE',
'LYON', 'LYON',
'MARSEILLE', 'MARSEILLE',
'MONTPELLIER', 'MONTPELLIER',
'NANCY', 'NANCY',
'NANTES', 'NANTES',
'NICE', 'NICE',
'RENNES', 'RENNES',
'STRASBOURG', 'STRASBOURG',
'TOULOUSE', 'TOULOUSE',
'ASNIERES-SUR-SEINE', 'ASNIERES-SUR-SEINE',
'BOULOGNE-BILLANCOURT', 'BOULOGNE-BILLANCOURT',
'COURBEVOIE', 'COURBEVOIE',
'ISSY-LES-MOULINEAUX', 'ISSY-LES-MOULINEAUX',
'LEVALLOIS-PERRET', 'LEVALLOIS-PERRET',
'MONTROUGE', 'MONTROUGE',
'NANTERRE', 'NANTERRE',
'NEUILLY-SUR-SEINE', 'NEUILLY-SUR-SEINE',
'RUEIL-MALMAISON', 'RUEIL-MALMAISON',
'SEVRES', 'SEVRES',
'VERSAILLES', 'VERSAILLES',
'PARIS' 'PARIS'
); );
public function getToken() public function getToken()
{ {
$ACCESSOR_URL = 'http://axe.mappy.com/1v1/'; $ACCESSOR_URL = 'http://axe.mappy.com/1v1/';
@ -41,36 +41,36 @@ class Mappy
$hash = md5($this->login."@".$this->password."@".$timestamp); $hash = md5($this->login."@".$this->password."@".$timestamp);
$preToken = $this->login."@".$timestamp."@".$hash; $preToken = $this->login."@".$timestamp."@".$hash;
$urlGetToken = $ACCESSOR_URL . 'token/generate.aspx?auth=' . urlencode($preToken) . '&ip=' . urlencode($_SERVER["REMOTE_ADDR"]); $urlGetToken = $ACCESSOR_URL . 'token/generate.aspx?auth=' . urlencode($preToken) . '&ip=' . urlencode($_SERVER["REMOTE_ADDR"]);
$fh = @fopen($urlGetToken, 'rb'); $fh = @fopen($urlGetToken, 'rb');
if ($fh == false) return false; if ($fh == false) return false;
$token = ''; $token = '';
while (!feof($fh))$token .= fread($fh, 8192); while (!feof($fh))$token .= fread($fh, 8192);
fclose($fh); fclose($fh);
return ($token); return ($token);
} }
protected function cleanAdress($ville) protected function cleanAdress($ville)
{ {
$ville = ' '.trim(preg_replace('/([0-9]|ARRONDISSEMENT|_)/i', ' ', $ville)).' '; $ville = ' '.trim(preg_replace('/([0-9]|ARRONDISSEMENT|_)/i', ' ', $ville)).' ';
$ville = trim(strtr($ville, array(' EME ' => '', ' ER ' => ''))); $ville = trim(strtr($ville, array(' EME ' => '', ' ER ' => '')));
return (ucwords(strtolower($ville))); return (ucwords(strtolower($ville)));
} }
public function villeCouverte($ville) public function villeCouverte($ville)
{ {
$ville = $this->cleanAdress($ville); $ville = $this->cleanAdress($ville);
if (in_array(strtoupper($ville),$this->villes)){ /*if (in_array(strtoupper($ville),$this->villes)){
return true; return true;
} }*/
return false; return false;
} }
public function getJs() public function getJs()
{ {
$token = $this->getToken(); $token = $this->getToken();
$href = 'http://axe.mappy.com/1v1/init/get.aspx?auth='.$token.'&version=2.16&solution=ajax'; $href = 'http://axe.mappy.com/1v1/init/get.aspx?auth='.$token.'&version=2.16&solution=ajax';
return $href; return $href;
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
class Menu class Scores_Menu
{ {
protected $menu = null; protected $menu = null;
protected $siret = null; protected $siret = null;
@ -101,6 +101,9 @@ class Menu
), ),
array( array(
'label' => 'IDENTITE', 'label' => 'IDENTITE',
'activateMenu' => array(
array('controller'=>'identite', 'action'=>'contacts'),
),
'pages' => array( 'pages' => array(
array( array(
'label' => "Fiche d'identité", 'label' => "Fiche d'identité",
@ -139,10 +142,16 @@ class Menu
'label' => "Modifications Insee", 'label' => "Modifications Insee",
'controller' => 'identite', 'controller' => 'identite',
'action' => 'evenements', 'action' => 'evenements',
'permission' => 'eveninsee',
'forceVisible' => true, 'forceVisible' => true,
'permission' => 'EVENINSEE', 'permission' => 'EVENINSEE',
), ),
array(
'label' => "Actualités Web/Internet",
'title' => "Toute la puissance des réseaux sociaux professionnels pour identifier rapidement un interlocuteur et accéder à ses coordonnées",
'controller' => 'identite',
'action' => 'corporama',
'forceVisible' => true,
),
), ),
), ),
array( array(
@ -169,6 +178,9 @@ class Menu
), ),
array( array(
'label' => 'ELEMENTS FINANCIERS', 'label' => 'ELEMENTS FINANCIERS',
'activateMenu' => array(
array('controller'=>'finance', 'action'=>'subvention'),
),
'pages' => array( 'pages' => array(
array( array(
'label' => "Synthèse", 'label' => "Synthèse",
@ -219,6 +231,12 @@ class Menu
'forceVisible' => true, 'forceVisible' => true,
'permission' => 'BANQUE', 'permission' => 'BANQUE',
), ),
array(
'label' => "Subventions",
'controller' => 'finance',
'action' => 'subventions',
'forceVisible' => true,
),
), ),
), ),
array( array(
@ -355,7 +373,6 @@ class Menu
array('controller'=> 'pieces', 'action'=>'associationbilans'), array('controller'=> 'pieces', 'action'=>'associationbilans'),
array('controller'=> 'pieces', 'action'=>'cmdcourrier'), array('controller'=> 'pieces', 'action'=>'cmdcourrier'),
array('controller'=> 'pieces', 'action'=>'kbis'), array('controller'=> 'pieces', 'action'=>'kbis'),
array('controller'=> 'pieces', 'action'=>'kbispasserelle'),
), ),
'pages' => array( 'pages' => array(
array( array(
@ -404,11 +421,6 @@ class Menu
'action' => 'liste', 'action' => 'liste',
'permission' => 'SURVLISTE' 'permission' => 'SURVLISTE'
), ),
array(
'label' => "Monitoring",
'controller' => 'giant',
'action' => 'retrive',
),
array( array(
'label' => "Surveillances fichier", 'label' => "Surveillances fichier",
'controller' => 'surveillance', 'controller' => 'surveillance',
@ -480,8 +492,6 @@ class Menu
*/ */
public function __construct($parameters) public function __construct($parameters)
{ {
require_once 'Scores/SessionEntreprise.php';
//Special case, edit foreign company //Special case, edit foreign company
if (array_key_exists('lienref', $parameters)) { if (array_key_exists('lienref', $parameters)) {
$this->lienref = $parameters['lienref']; $this->lienref = $parameters['lienref'];
@ -495,7 +505,7 @@ class Menu
$this->id = $parameters['id']; $this->id = $parameters['id'];
} }
if (empty($this->siret) && empty($this->id)) { if (empty($this->siret) && empty($this->id)) {
$session = new SessionEntreprise(null); $session = new Scores_Session_Entreprise(null);
$this->siret = $session->getSiret(); $this->siret = $session->getSiret();
$this->id = $session->getId(); $this->id = $session->getId();
} }
@ -613,8 +623,8 @@ class Menu
protected function computePage($pages) protected function computePage($pages)
{ {
$computePages = array(); $computePages = array();
foreach($pages as $page){ foreach( $pages as $page ) {
$visible = false; $visible = false;
if (array_key_exists('forceVisible', $page)){ if (array_key_exists('forceVisible', $page)){
$visible = $page['forceVisible']; $visible = $page['forceVisible'];
} }
@ -624,34 +634,45 @@ class Menu
$perm = $this->checkPermission($page['permission']); $perm = $this->checkPermission($page['permission']);
} }
if (!$perm && $visible){ $computePage = array();
$computePage = array();
if ( !$perm && $visible ) {
$computePage['label'] = $page['label']; $computePage['label'] = $page['label'];
$computePage['class'] = 'inactif'; $computePage['class'] = 'inactif';
$computePage['uri'] = '#'; $computePage['uri'] = '#';
$computePages[] = $computePage;
} elseif ($perm){
if ($this->checkParams($page['controller'], $page['action'])){
$computePage = array();
$computePage = $page;
$computePage['params'] = $this->setParams($page['controller'], $page['action']);
} elseif ( $perm ) {
if ( $this->checkParams($page['controller'], $page['action']) ) {
$computePage = $page;
$computePage['params'] = $this->setParams($page['controller'], $page['action']);
if (array_key_exists('pref', $page)){ if (array_key_exists('pref', $page)){
if ($this->hasPref('demanderef') && in_array('demanderef', $page['pref']) ){ // @todo: Erreur data if ($this->hasPref('demanderef') && in_array('demanderef', $page['pref']) ){ // @todo: Erreur data
$computePage['class'] = 'demanderef'; $computePage['class'] = 'demanderef';
} }
} }
$computePages[] = $computePage; } elseif ( $visible ) {
} elseif ($visible) {
$computePage = array();
$computePage['label'] = $page['label']; $computePage['label'] = $page['label'];
$computePage['class'] = 'inactif'; $computePage['class'] = 'inactif';
$computePage['uri'] = '#'; $computePage['uri'] = '#';
$computePages[] = $computePage;
} }
}
if ( array_key_exists('title', $page) ) {
$computePage['title'] = $page['title'];
}
if ( count($computePage)>0 ) {
$computePages[] = $computePage;
} }
} }
return $computePages; return $computePages;
} }
@ -726,8 +747,7 @@ class Menu
case 'last': case 'last':
case 'list': case 'list':
//Vérifier la présence d'au moins une recherche //Vérifier la présence d'au moins une recherche
require_once 'Scores/RechercheHistorique.php'; $recherches = new Scores_Session_Recherche();
$recherches = new RechercheHistorique();
if (count($recherches->liste()>0)){ if (count($recherches->liste()>0)){
return true; return true;
} }
@ -743,9 +763,6 @@ class Menu
} }
return true; return true;
break; break;
case 'giant':
return true;
break;
case 'user': case 'user':
switch($action){ switch($action){
case 'liste': case 'liste':
@ -795,6 +812,7 @@ class Menu
case 'groupe': case 'groupe':
case 'etablissements': case 'etablissements':
case 'evenements': case 'evenements':
case 'corporama':
if ( !empty($this->siret) && intval($this->siret)!=0 ){ if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true; return true;
} }

View File

@ -1,22 +0,0 @@
<?php
class SelectLang
{
protected $curLang = 'fr';
public function __construct()
{
$utilisateur = new Scores_Utilisateur();
$this->curLang = $utilisateur->getLang();
}
/**
* Retourne le titre de la colonne de la table selon la langue choisie
* @param string Column Name
* @return string New Column Name
*/
public function langSetDB($colName)
{
$newColName = ($this->curLang == 'fr') ? $colName : $colName.ucfirst($this->curLang);
return $newColName;
}
}

View File

@ -1,5 +1,5 @@
<?php <?php
class SessionEntreprise class Scores_Session_Entreprise
{ {
protected $index = 'entrep'; protected $index = 'entrep';
@ -157,4 +157,4 @@ class SessionEntreprise
return $compare; return $compare;
} }
} }

View File

@ -8,7 +8,7 @@
* ['consult'] = tableau des informations lors de la consultation d'une fiche * ['consult'] = tableau des informations lors de la consultation d'une fiche
* ['giant'] = tableau des informations lors de la consultation de la recherche giant. * ['giant'] = tableau des informations lors de la consultation de la recherche giant.
*/ */
class RechercheHistorique class Scores_Session_Recherche
{ {
protected $index = 'recherches'; protected $index = 'recherches';
protected $listeRecherche = array(); protected $listeRecherche = array();

View File

@ -22,7 +22,7 @@ class Scores_Utilisateur
* @return stdClass * @return stdClass
*/ */
public function updateProfil($InfosLogin, $password = null) public function updateProfil($InfosLogin, $password = null)
{ {
$identity = new stdClass; $identity = new stdClass;
$identity->username = $InfosLogin->result->login; $identity->username = $InfosLogin->result->login;
if ($password === null) { if ($password === null) {
@ -60,12 +60,12 @@ class Scores_Utilisateur
$identity->lang = $lang; $identity->lang = $lang;
$identity->langtmp = $lang; $identity->langtmp = $lang;
$identity->browser = $this->getBrowserInfo(); $identity->browser = $this->getBrowserInfo();
$this->identity = $identity; $this->identity = $identity;
return $identity; return $identity;
} }
/** /**
* Check if user is log in * Check if user is log in
* @return boolean * @return boolean
@ -273,7 +273,7 @@ class Scores_Utilisateur
{ {
return $this->identity->lang; return $this->identity->lang;
} }
/** /**
* Retourne la langue de l'interface du client * Retourne la langue de l'interface du client
*/ */
@ -281,7 +281,7 @@ class Scores_Utilisateur
{ {
return $this->identity->langtmp; return $this->identity->langtmp;
} }
/** /**
* Sets interface's language new value * Sets interface's language new value
* @param $langtmp * @param $langtmp

View File

@ -36,7 +36,8 @@ class Scores_Wkhtml_Pdf
if (empty($fileOut)) {$fileOut = str_replace('.html', '.pdf', $fileIn); } if (empty($fileOut)) {$fileOut = str_replace('.html', '.pdf', $fileIn); }
if(file_exists($fileOut)){ unlink($fileOut); } if(file_exists($fileOut)){ unlink($fileOut); }
$options = '--disable-internal-links'; $options = '--print-media-type';
$options.= ' --disable-internal-links';
if ( count($this->options) ) if ( count($this->options) )
{ {
foreach ( $this->options as $name => $value ) foreach ( $this->options as $name => $value )

160
library/Scores/Ws.php Normal file
View File

@ -0,0 +1,160 @@
<?php
/**
* Load User Info
*/
require_once 'Scores/Utilisateur.php';
/**
* Distribute Scores Webservice
*/
class Scores_Ws
{
/**
* User login
* @var string
*/
protected $login = null;
/**
* Password
* @var string
*/
protected $password = null;
/**
* Enable/Disable Cache
* @var boolean
*/
protected $cache = true;
/**
* Enable/Disable cache writing
* Override the cache flag
* @var boolean
*/
protected $cacheWrite = true;
/**
* Number of response
* @var int
*/
protected $nbReponses = 20;
protected $obj = null;
/**
* Scores_Ws
* @param string $login
* @param string $password
*/
public function __construct($login = null, $password = null)
{
if ( !empty($login) && !empty($password) ){
$this->login = $login;
$this->password = $password;
} else {
$user = new Scores_Utilisateur();
$this->login = $user->getLogin();
$this->password = $user->getPassword();
$this->nbReponses = $user->getNbRep();
if ( $user->checkModeEdition() ) {
//Disable cache
$this->cache = false;
//Don't write cache
if ( APPLICATION_ENV == 'staging' ) {
$this->cacheWrite = false;
}
}
}
}
/**
* Distribute call on each separate class for each service
* Schema for $name is {Class}_{Method}
* @param string $name
* @param array $args
* @return mixed
*/
public function __call($name, $args)
{
$response = false;
$pos = strpos($name, '_');
$className = substr($name, 0, $pos);
$methodName = substr($name, $pos+1);
$objR = new ReflectionClass('Scores_Ws_'.$className);
$this->obj = $objR->newInstance($methodName);
$this->obj->setSoapClientOption('login', $this->login);
$this->obj->setSoapClientOption('password', $this->password);
//Check cache
if ($this->cacheWrite && $this->obj->getCache()) {
$filename = $this->obj->getFilename();
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
$response = $cache->getBlock();
}
}
//Execute the request
else {
call_user_func_array(array($this->obj, $methodName), $args);
if ( !$this->obj->isError() || !$this->obj->isMessage() ) {
$response = $obj->getSoapResponse();
//Put in cache the response
if ($this->cacheWrite && $obj->getCache()) {
$cache->deletefile();
$cache->setBlock($responses);
}
}
}
return $response;
}
/**
* Type du retour
* @return string
* ERR or MSG
*/
public function getResponseType()
{
if ( $this->obj->isError() ) {
return 'ERR';
} elseif ( $this->obj->isMessage() ) {
return 'MSG';
}
return null;
}
/**
* Message de retour pour affichage
* @return string
*/
public function getResponseMsg()
{
return $this->obj->getMessage();
}
/**
* Retourne les éléments pour debuggage
* @return object
*/
public function getError()
{
$error = new stdClass();
$error->service = $this->obj->getServiceName();
$error->method = $this->obj->getMethodName();
//Request Parameter
$error->args = $this->obj->getParams();
$error->faultCode = $this->obj->getFaultCode();
$error->faultMessage = $this->obj->getMessage();
return $error;
}
}

View File

@ -0,0 +1,254 @@
<?php
require_once 'Scores/Ws/Config.php';
/** @see Scores_Ws_Interface */
require_once 'Scores/Ws/Interface.php';
/**
* Abstract class for Scores_Ws.
*/
abstract class Scores_Ws_Abstract implements Scosres_Ws_Interface
{
/**
* Service name
* @var string
*/
protected $service = null;
/**
* Method Name
* @var string
*/
protected $method = null;
/**
* Params for soap call as stdClass
* @var stdClass
*/
protected $params = null;
/**
* Default max response
* @var int
*/
protected $nbReponses = 20;
/**
* Set to false to disable cache for one method
* @var boolean
*/
protected $cache = true;
/**
* WSDL URI
* @var string
*/
protected $wsdl = null;
/**
* Options for WSDL
* @var array
*/
protected $options = array();
/**
* Soap Response
* @var object
*/
protected $response = null;
/**
* 0 = no error
* 1 = error
* 2 = message
* @var int
*/
protected $error = 0;
/**
* Error / Message
* @var string
*/
protected $message = '';
/**
* Original soap fault code
* @var string
*/
protected $faultcode = null;
/**
*
*/
public function __construct()
{
$config = new Scores_Ws_Config();
$config->setLocation('local');
$serviceConfig = $config->getService($this->service);
$this->setSoapClientWsdl($serviceConfig['wsdl']);
foreach ( $serviceConfig['options'] as $name => $value ) {
$this->setSoapClientOption($name, $value);
}
$this->setSoapClientOption('features', SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS);
$this->setSoapClientOption('compression', SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE);
$this->setSoapClientOption('trace', true);
$this->setSoapClientOption('encoding', 'utf-8');
if (APPLICATION_ENV == 'development'){
$this->setSoapClientOption('cache_wsdl', WSDL_CACHE_NONE);
}
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::setService()
*/
public function setService($name)
{
$this->service = $name;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Interface::getServiceName()
*/
public function getServiceName()
{
return $this->service;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Interface::getMethodName()
*/
public function getMethodName()
{
return $this->method;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Interface::getParams()
*/
public function getParams()
{
return var_export($this->params, true);
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Interface::getFaultCode()
*/
public function getFaultCode()
{
return $this->faultcode;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::setNbReponses()
*/
public function setNbReponses($nb)
{
$this->nbReponses = $nb;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::setSoapClientWsdl()
*/
public function setSoapClientWsdl($wsdl = null)
{
$this->wsdl = $wsdl;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::setSoapClientOption()
*/
public function setSoapClientOption($name = null , $value = null)
{
$this->options[$name] = $value;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::getSoapClient()
*/
public function getSoapClient()
{
$client = false;
try {
$client = new SoapClient($this->wsdl, $this->options);
} catch (Exception $e) {
throw new Exception('Application Error');
}
return $client;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::isError()
*/
public function isError()
{
if ( $this->error == 1 ) {
return true;
}
return false;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::isMessage()
*/
public function isMessage()
{
if ( $this->error == 2 ) {
return true;
}
return false;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::getSoapResponse()
*/
public function getSoapResponse()
{
return $this->response;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::getMessage()
*/
public function getMessage()
{
return $this->message;
}
/**
* (non-PHPdoc)
* @see Scores_Ws_Service_Interface::getFilename()
*/
public function getFilename($method, $args)
{
$filename = $this->service . '-' . $method . '-' . implode('-', $args);
return $filename;
}
public function getCache()
{
return $this->cache;
}
public function setCache($enable = true)
{
$this->cache = $enable;
}
}

View File

@ -0,0 +1,183 @@
<?php
require_once 'Scores/Ws/Abstract.php';
/**
*
*/
class Scores_Ws_Catalog extends Scores_Ws_Abstract
{
public function __construct()
{
$this->setService('catalog');
$this->cache = false;
parent::__construct();
}
/**
* Get the filename for a mathod
* @param string $method
* @param array $args
*/
public function getFilename($method, $args){}
/**
*
* @param unknown $id
* @param unknown $columns
*/
public function getEvent($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns = $columns;
$client = $this->getSoapClient();
try {
$response = $client->getEvent($params);
$this->response = $response->getEventResult;
} catch (SoapFault $fault) {
$this->message = $fault->faultstring;
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
public function getCatalogCurrency()
{
$filename = 'catalog-currency';
$cache = new Cache($filename);
if ( $cache->exist() ){
return $cache->getBlock();
}
$params = new stdClass();
$params->id = null;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getCurrency($params);
$cache->deletefile();
$cache->setBlock($reponse->getCurrencyResult);
return $reponse->getCurrencyResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function getCatalogCountry()
{
$filename = 'catalog-country';
$cache = new Cache($filename);
if ( $cache->exist() ){
return $cache->getBlock();
}
$params = new stdClass();
$params->id = null;
$params->columns = array(
'codPays3',
'libPays',
'devise',
'indTel',
);
$client = $this->loadClient('catalog');
try {
$reponse = $client->getCountry($params);
$cache->deletefile();
$cache->setBlock($reponse->getCountryResult);
return $reponse->getCountryResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function getCatalogEvent($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns = $columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getEvent($params);
return $reponse->getEventResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getCatalogNaf5($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns =$columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getNaf5($params);
return $reponse->getNaf5Result;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getCatalogFctDir($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns =$columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getDirFonction($params);
return $reponse->getDirFonctionResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getCatalogLegalForm($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns =$columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getLegalForm($params);
return $reponse->getLegalFormResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
}

View File

@ -0,0 +1,229 @@
<?php
/**
* WebService Configuration
*/
class Scores_Ws_Config
{
protected $location = null;
protected $services = array(
//Local
'local' => array(
'interne' => array(
'wsdl' => "http://webservice-2.4.sd.dev/interne/v0.6?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'entreprise' => array(
'wsdl' => "http://webservice-2.4.sd.dev/entreprise/v0.8?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'gestion' => array(
'wsdl' => "http://webservice-2.4.sd.dev/gestion/v0.3?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'saisie' => array(
'wsdl' => "http://webservice-2.4.sd.dev/saisie/v0.2?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'pieces' => array(
'wsdl' => "http://webservice-2.4.sd.dev/pieces/v0.1?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'catalog' => array(
'wsdl' => "http://webservice-2.4.sd.dev/catalog/v0.1?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
),
//Development
'development' => array(
'interne' => array(
'wsdl' => "http://webservice-2.4.sd.lan/interne/v0.6?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'entreprise' => array(
'wsdl' => "http://webservice-2.4.sd.lan/entreprise/v0.8?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'gestion' => array(
'wsdl' => "http://webservice-2.4.sd.lan/gestion/v0.3?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'saisie' => array(
'wsdl' => "http://webservice-2.4.sd.lan/saisie/v0.2?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'pieces' => array(
'wsdl' => "http://webservice-2.4.sd.lan/pieces/v0.1?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'catalog' => array(
'wsdl' => "http://webservice-2.4.sd.lan/catalog/v0.1?wsdl-auto",
'options' => array(
'soap_version' => SOAP_1_2
),
),
),
//sd-25137
'sd-25137' => array(
'interne' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'entreprise' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/entreprise/v0.8?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'gestion' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/gestion/v0.3?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'saisie' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/saisie/v0.2?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'pieces' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/pieces/v0.1?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'catalog' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/catalog/v0.1?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
),
//Celeste
'celeste' => array(
'interne' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'entreprise' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/entreprise/v0.8?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'gestion' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/gestion/v0.3?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'saisie' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/saisie/v0.2?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'pieces' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/pieces/v0.1?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'catalog' => array(
'wsdl' => "http://wse.scores-decisions.com:8081/catalog/v0.1?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
),
//Celeste Staging
'celeste-staging' => array(
'interne' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'entreprise' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'gestion' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'saisie' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'pieces' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
'catalog' => array(
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
'options' => array(
'soap_version' => SOAP_1_2
),
),
),
);
/**
*
*/
public function setLocation($name)
{
$this->location = $name;
}
/**
* Return service parameters
* @param string $name
* @return array
*/
public function getService($name)
{
return $this->services[$this->location][$name];
}
}

View File

@ -0,0 +1,952 @@
<?php
require_once 'Scores/Ws/Abstract.php';
class Scores_Ws_Entreprise extends Scores_Ws_Abstract
{
public function __construct($method = null)
{
//Set service to use
$this->setService('entreprise');
//Prepare method configuration
if(null !== $method && method_exists($this, $method)) {
$this->{$method.'Params'}();
}
parent::__construct();
}
/**
* getAnnonces
* @param string $siren
* @param integer $filtre
* @param string $idAnn
* @param integer $position
* @param integer $nbRep
* @void
*/
public function getAnnonces($siren, $filtre=0, $idAnn='', $position=0, $nbRep=100)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->filtre = $filtre;
$this->params->idAnn = $idAnn;
$client = $this->getSoapClient();
try {
$response = $client->getAnnonces($this->params);
$this->response = $response->getAnnoncesResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getAnnoncesAsso
* @param string $siren
* @param string $idAnn
* @param string $filtre
* @param number $position
* @param number $nbRep
*/
public function getAnnoncesAsso($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->idAnn = $idAnn;
$this->params->filtre = $filtre;
$this->params->position = $position;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getAnnoncesAsso($this->params);
$this->response = $response->getAnnoncesAssoResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getAnnoncesBalo
* @param string $siren
* @param string $idAnn
* @param string $filtre
* @param number $position
* @param number $nbRep
* @void
*/
public function getAnnoncesBalo($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->idAnn = $idAnn;
$this->params->filtre = $filtre;
$this->params->position = $position;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getAnnoncesBalo($this->params);
$this->response = $response->getAnnoncesBaloResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getAnnoncesBoamp
* @param string $siren
* @param string $idAnn
* @param string $filtre
* @param number $position
* @param number $nbRep
* @void
*/
public function getAnnoncesBoamp($siren, $idAnn=null, $filtre = null, $position=0, $nbRep=20)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->idAnn = $idAnn;
$this->params->filtre = null;
if (!empty($filtre) && in_array($filtre,array('A','M'))) {
$filtreStruct = new stdClass();
$filtreStruct->key = 'type';
$filtreStruct->value = $filtre;
$this->params->filtre[] = $filtreStruct;
}
$this->params->position = $position;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getAnnoncesBoamp($this->params);
$this->response = $response->getAnnoncesBoampResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getAnnoncesLegales
* @param string $siren
* @param string $idAnn
* @param string $filtre
* @param number $position
* @param number $nbRep
* @void
*/
public function getAnnoncesLegales($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->idAnn = $idAnn;
$this->params->filtre = $filtre;
$this->params->position = $position;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getAnnoncesLegales($this->params);
$this->response = $response->getAnnoncesLegalesResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getAnnoncesNum
* @param string $siren
* @void
*/
public function getAnnoncesNum($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getAnnoncesNum($this->params);
$this->response = $response->getAnnoncesNumResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getBanques
* @param string $siren
* @void
*/
public function getBanques($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getBanques($this->params);
$this->response = $response->getBanquesResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getBilan
* @param string $siren
* @param string $millesime
* @param string $typeBilan
* @param string $ref
* @void
*/
public function getBilan($siren, $millesime, $typeBilan, $ref)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->millesime = $millesime;
$this->params->typeBilan = $typeBilan;
$this->params->ref = $ref;
$client = $this->getSoapClient();
try {
$response = $client->getBilan($this->params);
$this->response = $response->getBilanResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getIdentiteParams
* @void
*/
public function getIdentiteParams()
{
$this->setCache(false);
}
/**
* getIdentite
* @param string $siret
* @param int $id
* @void
*/
public function getIdentite($siret, $id = 0)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siret = $siret;
$this->params->id = $id;
$client = $this->getSoapClient();
try {
$response = $client->getIdentite($this->params);
$this->response = $response->getIdentiteResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('1020')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getIdentiteProcol
* @param string $siret
* @param int $id
* @void
*/
public function getIdentiteProcol($siret, $id = 0)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siret = $siret;
$this->params->id = $id;
$client = $this->getSoapClient();
try {
$response = $client->getIdentiteProcol($this->params);
$this->response = $response->getIdentiteProcolResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getIndiScore
* @param string $siren
* @param string $nic
* @param integer $niveau
* @param boolean $plus
* @param string $ref
* @param integer $encours
* @param string $email
*/
public function getIndiScore($siren, $nic=0, $niveau=2, $plus=false, $ref='', $encours=0, $email='')
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->nic = $nic;
$this->params->niveau = $niveau;
$this->params->plus = $plus;
$this->params->ref = $ref;
$this->params->encours = $encours;
$this->params->email = $email;
$client = $this->getSoapClient();
try {
$response = $client->getIndiScore($this->params);
$this->response = $response->getIndiScoreResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('1020')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getInfosBourse
* @param string $siren
* @void
*/
public function getInfosBourse($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getInfosBourse($this->params);
$this->response = $response->getInfosBourseResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('1030')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getInfosReg
* @param string $siren
* @param mixed $id
* @void
*/
public function getInfosReg($siren, $id = false)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->id = $id;
$client = $this->getSoapClient();
try {
$response = $client->getInfosReg($this->params);
$this->response = $response->getInfosRegResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('1030')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getDirigeants
* @param string $siren
* @param boolean $histo
* @void
*/
public function getDirigeants($siren, $histo=false)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->histo = $histo;
$client = $this->getSoapClient();
try {
$response = $client->getDirigeants($this->params);
$this->response = $response->getDirigeantsResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getLienRef
* @param string $id
* @void
*/
public function getLienRef($id)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->id = $id;
$client = $this->getSoapClient();
try {
$response = $client->getLienRef($this->params);
$this->response = $response->getLienRefResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('ERR','MSG')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getLiens
* @param string $siren
* @void
*/
public function getLiens($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getLiens($this->params);
$this->response = $response->getLiensResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('MSG')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getLiensById
* @param int $id
* @void
*/
public function getLiensById($id)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->id = $id;
$client = $this->getSoapClient();
try {
$response = $client->getLiensById($this->params);
$this->response = $response->getLiensByIdResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('MSG')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* getListeBilans
* @param string $siren
*/
public function getListeBilans($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getListeBilans($this->params);
$this->response = $response-getListeBilansResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getListeCompetences
* @param string $siret
* @param string $type
* @param string $codeInsee
*/
public function getListeCompetences($siret, $type, $codeInsee)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siret = $siret;
$this->params->type = $type;
$this->params->codeInsee = $codeInsee;
$client = $this->getSoapClient();
try {
$response = $client->getListeCompetences($this->params);
$this->response = $response->getListeCompetencesResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getListeEtablissements
* @param string $siren
* @void
*/
public function getListeEtablissements($siren, $actif = -1, $position = 0)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$params->siren = $siren;
$params->actif = $actif;
$params->position = $position;
$client = $this->getSoapClient();
try {
$response = $client->getListeEtablissements($this->params);
$this->response = $response->getListeEtablissementsResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getListeEvenements
* @param string $siren
* @param string $nic
* @param integer $position
* @param integer $nbRep
* @void
*/
public function getListeEvenements($siren, $nic=0, $position=0, $nbRep=200)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$params->siren = $siren;
$params->nic = $nic;
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getListeEvenements($this->params);
$this->response = $response->getListeEvenementsResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getRapport
* @param string $siren
* @param integer $niveau
* @param integer $id
* @param boolean $plus
* @param string $ref
* @param integer $encours
* @param string $email
* @void
*/
public function getRapport($siren, $niveau=3, $id=0, $plus=false, $ref='', $encours=0, $email='')
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->niveau = $niveau;
$this->params->d = $id;
$this->params->plus = $plus;
$this->params->ref = $ref;
$this->params->encours = $encours;
$this->params->email = $email;
$client = $this->getSoapClient();
try {
$response = $client->getRapport($this->params);
$this->response = $response->getRapportResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getRatios
* @param string $siren
* @param string $page
*/
public function getRatios($siren, $page = 'ratios')
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$this->params->page = $page;
$client = $this->getSoapClient();
try {
$response = $client->getRapport($this->params);
$this->response = $response->getRapportResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getSurveillancesParams
*/
public function getSurveillancesParams()
{
$this->setCache(false);
}
/**
* getSurveillances
* @param object $filtre
* @param integer $deb
* @param integer $nbRep
* @param string $tri
*/
public function getSurveillances($filtre, $deb=0, $nbRep=100)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->filtre = $filtre;
$this->params->position = $deb;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->getSurveillances($this->params);
$this->response = $response->getSurveillancesResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* getValo
* @param string $siren
* @void
*/
public function getValo($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->getValo($this->params);
$this->response = $response->getValoResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
if ( in_array($fault->getCode(), array('1020')) ){
$this->error = 2;
} else {
$this->error = 1;
}
}
}
/**
* isSirenExistant
* @param string $siren
*/
public function isSirenExistant($siren)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siren = $siren;
$client = $this->getSoapClient();
try {
$response = $client->isSirenExistant($this->params);
$this->response = $response->isSirenExistantResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* rechercheAnnonceParams
* @void
*/
public function rechercheAnnonceParams()
{
$this->setCache(false);
}
/**
* Recherche Annonce
* @param string $source
* @param string $dateAnnee
* @param integer $numParution
* @param integer $numAnnonce
*/
public function rechercheAnnonce($source, $dateAnnee, $numParution, $numAnnonce)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->source = $source;
$this->params->dateAnnee = $dateAnnee;
$this->params->numParution = $numParution;
$this->params->numAnnonce = $numAnnonce;
$client = $this->getSoapClient();
try {
$response = $client->rechercheAnnonce($this->params);
$this->response = $response->rechercheAnnonceResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* searchEntrepriseParams
* @void
*/
public function searchEntrepriseParams()
{
$this->setCache(false);
}
/**
* searchEntreprise
* @param array $criteres
* @param int $position
* @param int $nbRep
* @param int $actif
*/
public function searchEntreprise($criteres, $position = 0, $nbRep = null)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->criteres = new StdClass;
$this->params->criteres->identifiant = $criteres['identifiant'];
$this->params->criteres->raisonSociale = $criteres['raisonSociale'];
$this->params->criteres->adresse = $criteres['adresse'];
$this->params->criteres->codePostal = $criteres['codePostal'];
$this->params->criteres->ville = $criteres['ville'];
$this->params->criteres->telFax = $criteres['telFax'];
$this->params->criteres->naf = $criteres['naf'];
$this->params->criteres->siege = false;
$this->params->criteres->actif = in_array($criteres['actif'], array(0,1,2)) ? $criteres['actif'] : 2;
$this->params->criteres->fj = $criteres['fj'];
$this->params->position = $position;
$this->params->nbRep = empty($nbRep) ? $this->nbReponses : $nbRep ;
$client = $this->getSoapClient();
try {
$response = $client->searchEntreprise($this->params);
$this->response = $response->searchEntrepriseeResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* searchDirParams
* @void
*/
public function searchDirParams()
{
$this->setCache(false);
}
/**
* Recherche par dirigeants
* @param array $criteres
* @param integer $deb
* @param integer $nbRep
* @param integer $maxRep
*/
public function searchDir($criteres, $deb=0, $nbRep=20, $maxRep=200)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->criteres->nom = $criteres['dirNom'];
$this->params->criteres->prenom = $criteres['dirPrenom'];
$this->params->criteres->dateNaiss = $criteres['dirDateNaiss'];
$this->params->criteres->lieuNaiss = $criteres['lieuNaiss'];
$this->params->criteres->pertinence = ($criteres['pertinence']===true) ? true : false ;
$this->params->deb = $deb;
$this->params->nbRep = $nbRep;
$this->params->maxRep = $maxRep;
$client = $this->getSoapClient();
try {
$response = $client->searchDir($this->params);
$this->response = $response->searchDirResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* searchRefClientParams
* @void
*/
public function searchRefClientParams()
{
$this->setCache(false);
}
/**
* Recherche par référence client
* @param string $search
* @param integer $position
* @param integer $nbRep
*/
public function searchRefClient($search, $position=0, $nbRep=20)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->search = $search;
$this->params->position = $position;
$this->params->nbRep = $nbRep;
$client = $this->getSoapClient();
try {
$response = $client->searchRefClient($this->params);
$this->response = $response->searchRefClientResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
/**
* setSurveillance
* @param string $siret
* @param string $email
* @param string $ref
* @param string $source
* @param boolean $delete
* @param integer $encoursClient
* @void
*/
public function setSurveillance($siret, $email, $ref = '', $source='annonces', $delete=false, $encoursClient=0)
{
$this->method = __METHOD__;
$this->params = new StdClass();
$this->params->siret = $siret;
$this->params->email = $email;
$this->params->ref = $ref;
$this->params->source = $source;
$this->params->delete = $delete;
$this->params->encoursClient = $encoursClient;
$client = $this->getSoapClient();
try {
$response = $client->setSurveillance($this->params);
$this->response = $response->setSurveillanceResult;
} catch (SoapFault $fault) {
$this->faultcode = $fault->getCode();
$this->message = $fault->getMessage();
$this->error = 1;
}
}
}

View File

@ -0,0 +1,459 @@
<?php
class Scores_Ws_Gestion extends Scores_Ws_Abstract
{
/**
* getCategory
*/
public function getCategory()
{
$filename = 'category';
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock('category');
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->getCategory();
$cache->deletefile();
$cache->setBlock($reponse->getCategoryResult);
return $reponse->getCategoryResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
//Placer exception pour affichage message
return false;
}
}
/**
* getListeDroits
*/
public function getListeDroits()
{
$filename = 'droits';
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock('droits');
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->getListeDroits();
$cache->deletefile();
$cache->setBlock($reponse->getListeDroitsResult);
return $reponse->getListeDroitsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
//Placer exception pour affichage message
return false;
}
}
/**
* getNextLogin
* @param int $idClient
*/
public function getNextLogin($idClient)
{
$params = new stdClass();
$params->idClient = $idClient;
try {
$client = $this->loadClient('gestion');
$reponse = $client->getNextLogin($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->getNextLoginResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
Zend_Registry::get('firebug')->info($fault);
//Placer exception pour affichage message
return false;
}
}
/**
* getLogs
*/
public function getLogs()
{
$filename = 'logs';
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock('logs');
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->getLogs();
$cache->deletefile();
$cache->setBlock($reponse->getLogsResult);
return $reponse->getLogsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
//Placer exception pour affichage message
return false;
}
}
/**
* getListePrefs
*/
public function getListePrefs()
{
$filename = 'prefs';
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock('prefs');
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->getListePrefs();
$cache->deletefile();
$cache->setBlock($reponse->getListePrefsResult);
return $reponse->getListePrefsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
//Placer exception pour affichage message
return false;
}
}
/**
* Enregistre ou modifie un client
* @param unknown_type $infos
* @return boolean
*/
public function setClient($infos)
{
$params = new stdClass();
$params->infos = json_encode($infos);
try {
$client = $this->loadClient('gestion');
$reponse = $client->setClient($params);
return $reponse->setClientResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
Zend_Registry::get('firebug')->info($fault);
//Placer exception pour affichage message
return false;
}
}
/**
* setInfosLogin
* @param string $login
* @param string $action
* @param array $infos
*/
public function setInfosLogin($login, $action, $infos = null)
{
$params = new stdClass();
$params->login = $login;
$params->action = $action;
if ($infos !== null ) {
$params->infos = json_encode($infos);
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->setInfosLogin($params);
return $reponse->setInfosLoginResult;
} catch (SoapFault $fault) {
if (in_array($fault->getCode(),array('MSG','ERR'))) {
return $fault->getMessage();
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
Zend_Registry::get('firebug')->info($fault);
//Placer exception pour affichage message
return false;
}
}
}
/**
* getInfosLogin
* @param string $login
* @param string $ipUtilisateur
*/
public function getInfosLogin($login, $ipUtilisateur = '')
{
$params = new stdClass();
$params->login = $login;
$params->ipUtilisateur = $ipUtilisateur;
try {
$client = $this->loadClient('gestion');
$reponse = $client->getInfosLogin($params);
return $reponse->getInfosLoginResult;
} catch (SoapFault $fault) {
if (substr($fault->faultcode,0,1)=='0'){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* getListeUtilisateurs
* Enter description here ...
* @param string $login
* @param integer $idClient
*/
public function getListeUtilisateurs($login, $idClient = -1)
{
$params = new stdClass();
$params->login = $login;
$params->idClient = $idClient;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getListeUtilisateurs($params);
return $reponse->getListeUtilisateursResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getListeClients
* @param unknown_type $idClient
*/
public function getListeClients($idClient=false)
{
$params = new stdClass();
$params->idClient = $idClient;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getListeClients($params);
return $reponse->getListeClientsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getLogsClients
* @param unknown_type $mois
* @param unknown_type $detail
* @param unknown_type $idClient
* @param unknown_type $login
* @param unknown_type $all
*/
public function getLogsClients($mois, $detail=0, $idClient=0, $login='', $all=0)
{
$params = new stdClass();
$params->mois = $mois;
$params->detail = $detail;
$params->idClient = $idClient;
$params->login = $login;
$params->all = $all;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getLogsClients($params);
return $reponse->getLogsClientsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function setCGU()
{
$params = new stdClass();
$params->application ='';
$client = $this->loadClient('gestion');
try {
$reponse = $client->setCGU($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->setCGUResult;
} catch(SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Get all infos for a user (Admin)
* @param string $login
*/
public function getUser($login)
{
$params = new stdClass();
$params->login = $login;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getUser($params);
return $reponse->getUserResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function getServiceUsers($idClient, $service)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->serviceCode = $service;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getServiceUsers($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->getServiceUsersResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getServices($idClient)
{
$params = new stdClass();
$params->idClient = $idClient;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getServices($params);
return $reponse->getServicesResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setClientTarif($idClient, $log, $service, $type, $priceUnit, $limit, $date, $duree, $doublon)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->tarif->log = $log;
$params->tarif->service = $service;
$params->tarif->type = $type;
$params->tarif->priceUnit = $priceUnit;
$params->tarif->limit = $limit;
$params->tarif->date = $date;
$params->tarif->duree = $duree;
$params->tarif->doublon = $doublon;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setClientTarif($params);
return $reponse->setClientTarifResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getClientTarifs($idClient, $service = null)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->service = $service;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getClientTarifs($params);
return $reponse->getClientTarifsResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setService($idClient, $infos)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->infos = $infos;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setService($params);
return $reponse->setServiceResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function searchLogin($idClient, $query)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->query = $query;
$client = $this->loadClient('gestion');
try {
$reponse = $client->searchLogin($params);
return $reponse->searchLoginResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function setSurveillancesMail($login, $email)
{
$params = new stdClass();
$params->login = $login;
$params->email = $email;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setSurveillancesMail($params);
return $reponse->setSurveillancesMailResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setUserService($login, $code)
{
$params = new stdClass();
$params->login = $login;
$params->code = $code;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setUserService($params);
return $reponse->setUserServiceResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
}

View File

@ -0,0 +1,88 @@
<?php
/**
* Interface class for Scores_Ws
*/
interface Scores_Ws_Interface
{
/**
* Define service name
* @param string $name
*/
public function setService($name);
/**
* Get the service name
* @void
*/
public function getServiceName();
/**
* Get Method name
* @void
*/
public function getMethodName();
/**
* Get Params
* @void
*/
public function getParams();
/**
* Get fault code
* @void
*/
public function getFaultCode();
/**
* Set the default for max responses
* @param int $nb
*/
public function setNbReponses($nb);
/**
* Define WSDL URI
* @param string $wsdl
*/
public function setSoapClientWsdl($wsdl = null);
/**
* Define options for SoapClient
* @param string $name
* @param string $value
*/
public function setSoapClientOption($name = null , $value = null);
/**
* Instantiate Soap Client
*/
public function getSoapClient();
/**
* Get Soap Response
*/
public function getSoapResponse();
/**
* True if the response is an error
*/
public function isError();
/**
* True if the response is a message
*/
public function isMessage();
/**
* Return message (error)
*/
public function getMessage();
/**
* Get the filename for a mathod
* @param string $method
* @param array $args
*/
public function getFilename($method, $args);
}

View File

@ -0,0 +1,654 @@
<?php
class Scores_Ws_Interne extends Scores_Ws_Abstract
{
/**
* setCmdAsso
* @param unknown_type $infosCommande
* @param unknown_type $infosDemandeur
* @return boolean
*/
public function setCmdAsso($infosCommande, $infosDemandeur)
{
$params = new stdClass();
$params->infosCommande = $infosCommande;
$params->infosDemandeur = $infosDemandeur;
try {
$client = $this->loadClient('interne');
$reponse = $client->setCmdAsso($params);
return $reponse->setCmdAssoResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
Zend_Registry::get('firebug')->info($fault);
//Placer exception pour affichage message
return false;
}
}
/**
* getIdentiteLight
* @param string $siret
* @param int $id
* @return mixed
*/
public function getIdentiteLight($siret, $id = 0)
{
$filename = 'identitelight-'.$siret.'-'.$id;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new StdClass();
$params->siret = $siret;
$params->id = $id;
$client = $this->loadClient('interne');
try {
$reponse = $client->getIdentiteLight($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getIdentiteLightResult);
}
return $reponse->getIdentiteLightResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getDirigeantsOp
* @param string $siren
*/
public function getDirigeantsOp($siren)
{
$filename = 'dirigeantsop-'.$siren;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new StdClass();
$params->siren = $siren;
$client = $this->loadClient('interne');
try {
$reponse = $client->getDirigeantsOp($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getDirigeantsOpResult);
}
return $reponse->getDirigeantsOpResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getPortefeuille
* @param object $filtre
* @param integer $position
* @param integer $nbAffichage
*/
public function getPortefeuille($filtre, $position = 0, $nbAffichage = 100)
{
$params = new StdClass;
$params->filtre = $filtre;
$params->deb = $position;
$params->nbRep = $nbAffichage;
$client = $this->loadClient('interne');
try {
$reponse = $client->getPortefeuille($params);
return $reponse->getPortefeuilleResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getListeConventions
* Enter description here ...
* @param string $siren
*/
public function getListeConventions($siren)
{
$filename = 'conventions-'.$siren;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('interne');
try {
$reponse = $client->getListeConventions($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getListeConventionsResult);
}
return $reponse->getListeConventionsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getMarques
* Enter description here ...
* @param string $siren
* @param integer $idDepot
*/
public function getMarques($siren, $idDepot = 0)
{
$filename = 'marques-'.$siren.'-'.$idDepot;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new stdClass();
$params->siren = $siren;
$params->idDepot = $idDepot;
$client = $this->loadClient('interne');
try {
$reponse = $client->getMarques($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getMarquesResult);
}
return $reponse->getMarquesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getPrivilegesDetail
* Enter description here ...
* @param unknown_type $siren
* @param unknown_type $tabTypes
*/
public function getPrivilegesDetail($siren, $tabTypes = array() )
{
$params = new stdClass();
$params->siren = $siren;
$params->tabTypes = $tabTypes;
$client = $this->loadClient('interne');
try {
$reponse = $client->getPrivilegesDetail($params);
return $reponse->getPrivilegesDetailResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getDevises
* Enter description here ...
* @param unknown_type $codeIsoDevise
*/
public function getDevises($codeIsoDevise = '')
{
$params = new stdClass();
$params->codeIsoDevise = $codeIsoDevise;
$client = $this->loadClient('interne');
try {
$reponse = $client->getDevises($params);
return $reponse->getDevisesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getPrivilegesCumul
* Enter description here ...
* @param unknown_type $siren
* @param unknown_type $tabTypes
*/
public function getPrivilegesCumul($siren, $tabTypes = array() )
{
$params = new stdClass();
$params->siren = $siren;
$params->tabTypes = $tabTypes;
$client = $this->loadClient('interne');
try {
$reponse = $client->getPrivilegesCumul($params);
return $reponse->getPrivilegesCumulResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getTribunaux
* Enter description here ...
* @param unknown_type $tabTypes
*/
public function getTribunaux($tabTypes = array())
{
$params = new stdClass();
$params->tabTypes = $tabTypes;
$client = $this->loadClient('interne');
try {
$reponse = $client->getTribunaux($params);
return $reponse->getTribunauxResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getListeJalCollecte
* Enter description here ...
*/
public function getListeJalCollecte()
{
$filename = 'listejalcollecte';
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
$params = new stdClass();
$client = $this->loadClient('interne');
try {
$reponse = $client->getListeJalCollecte();
$cache->deletefile();
$cache->setBlock($reponse->getListeJalCollecteResult);
return $reponse->getListeJalCollecteResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Recherche Actionnaire
* @param unknown_type $nom
* @param unknown_type $cpVille
* @param unknown_type $siren
* @param unknown_type $pays
* @param unknown_type $pctMin
* @param unknown_type $pctMax
* @param unknown_type $deb
* @param unknown_type $nbRep
* @param unknown_type $maxRep
* @param unknown_type $pertinence
*/
public function searchAct($nom, $cpVille='', $siren='', $pays='', $pctMin=0, $pctMax=100, $deb=0)
{
$params = new stdClass();
$params->nom = $nom;
$params->cpVille = $cpVille;
$params->siren = $siren;
$params->pays = $pays;
$params->pctMin = $pctMin;
$params->pctMax= $pctMax;
$params->pertinence = false;
$params->deb = $deb;
$params->nbRep = $this->nbReponses;
//$params->maxRep = $maxRep;
$client = $this->loadClient('interne');
try {
$reponse = $client->searchAct($params);
return $reponse->searchActResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Recherche Historique
* @param string $recherche
* @param string $annee
* @param string $typeBod
* @param integer $deb
*/
public function rechercheHisto($recherche, $annee, $typeBod, $deb = 0)
{
$params = new stdClass();
$params->recherche = $recherche;
$params->annee = $annee;
$params->typeBod = $typeBod;
$params->deb = $deb;
$params->nbRep = $this->nbReponses;
$client = $this->loadClient('interne');
try {
$reponse = $client->rechercheHisto($params);
return $reponse->rechercheHistoResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* searchMandataires
* @param unknown_type $nom
* @param unknown_type $type
* @param unknown_type $cpDep
*/
public function searchMandataires($nom, $type=array(), $cpDep=0)
{
$params = new stdClass();
$params->nom = $nom;
$params->type = $type;
$params->cpDep = $cpDep;
$client = $this->loadClient('interne');
try {
$reponse = $client->searchMandataires($params);
return $reponse->searchMandatairesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* setMandataire
* Enter description here ...
* @param unknown_type $infos
*/
public function setMandataire($infos)
{
$params = new stdClass();
$params->infos->id = $infos['id'];
$params->infos->sirenGrp = $infos['sirenGrp'];
$params->infos->sirenMand = $infos['sirenMand'];
$params->infos->Nom = $infos['Nom'];
$params->infos->Prenom = $infos['Prenom'];
$params->infos->type = $infos['type'];
$params->infos->stagiaire = $infos['stagiaire'];
$params->infos->coursAppel = $infos['coursAppel'];
$params->infos->coursAppel2 = $infos['coursAppel2'];
$params->infos->tribunal = $infos['tribunal'];
$params->infos->Statut = $infos['Statut'];
$params->infos->adresse = $infos['adresse'];
$params->infos->adresseComp = $infos['adresseComp'];
$params->infos->cp = $infos['cp'];
$params->infos->ville = $infos['ville'];
$params->infos->tel = $infos['tel'];
$params->infos->fax = $infos['fax'];
$params->infos->email = $infos['email'];
$params->infos->web = $infos['web'];
$params->infos->contact = $infos['contact'];
$client = $this->loadClient('interne');
try {
$reponse = $client->setMandataire($params);
return $reponse->setMandataireResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getIdCourAppel
* @param string $codeTribunal
*/
public function getIdCoursAppel($codeTribunal)
{
$params = new stdClass();
$params->codeTribunal = $codeTribunal;
$client = $this->loadClient('interne');
try {
$reponse = $client->getIdCoursAppel($params);
return $reponse->getIdCoursAppelResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* setLog
* @param string $page
* @param string $siret
* @param string $id
* @param string $ref
*/
public function setLog ($page, $siret, $id=0, $ref = '')
{
$params = new stdClass();
$params->page = $page;
$params->siret = $siret;
$params->id = $id;
$params->ref = $ref;
$client = $this->loadClient('interne');
try {
$reponse = $client->setLog($params);
return true;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getListeSurveillanceCsv
* @param unknown_type $source
* @param unknown_type $login
* @param unknown_type $idClient
*/
public function getListeSurveillancesCsv($source='', $login='', $idClient=0)
{
$params = new stdClass();
$params->source = $source;
$params->login = $login;
$params->idClient = $idClient;
$client = $this->loadClient('interne');
try {
$reponse = $client->getListeSurveillancesCsv($params);
return $reponse->getListeSurveillancesCsvResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getPortefeuilleCsv
* @param unknown_type $login
* @param unknown_type $idClient
*/
public function getPortefeuilleCsv($login='', $idClient=0)
{
$params = new stdClass();
$params->login = $login;
$params->idClient = $idClient;
//@todo : Seulement pour aider Altysis
$c = Zend_Registry::get('config');
$location = $c->profil->webservice->location;
$cWS = new Zend_Config_Ini(realpath(dirname(__FILE__)) . '/webservices.ini');
$config = $cWS->toArray();
$this->webservices = $config[$location]['webservices'];
//@todo
$client = $this->loadClient('interne');
try {
$reponse = $client->getPortefeuilleCsv($params);
return $reponse->getPortefeuilleCsvResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Enter description here ...
* @param string $idAnn
* @param string $siret
*/
public function getAnnonceCollecte($idAnn, $siret)
{
$params = new stdClass();
$params->idAnn= $idAnn;
$params->siret = $siret;
$client = $this->loadClient('interne');
try {
$reponse = $client->getAnnonceCollecte($params);
return $reponse->getAnnonceCollecteResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Enter description here ...
* @param unknown_type $siren
* @return Ambigous <boolean, mixed>|boolean
*/
public function getListeDepots($siren)
{
$filename = 'listedepots-'.$siren;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('interne');
try {
$reponse = $client->getListeDepots($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getListeDepotsResult);
}
return $reponse->getListeDepotsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Commande d'une enquete intersud
* @param string $siren
* @param array $infoEnq
* @param array $infoUser
*/
public function commandeEnquete($siren, $infoEnq, $infoUser)
{
$params = new stdClass();
$params->siren = $siren;
$params->infoEnq = json_encode($infoEnq);
$params->infoDemande = json_encode($infoUser);
$client = $this->loadClient('interne');
try {
$reponse = $client->commandeEnquete($params);
return $reponse->commandeEnqueteResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Retourne l'arborescence d'un groupe
* @param string $siren
* @param int pctMin
* @param int $nbNiveaux
*/
public function getGroupesArbo($siren, $pctMin=33, $nbNiveaux=10)
{
$filename = 'groupesarbo-'.$siren.'-'.$pctMin;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new StdClass;
$params->siren = $siren;
$params->pctMin = $pctMin;
$params->nbNiveaux = $nbNiveaux;
$client = $this->loadClient('interne');
try {
$reponse = $client->getGroupesArbo($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getGroupesArboResult);
}
return $reponse->getGroupesArboResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Retourne les infos du groupe
* @param string $siren
*/
public function getGroupeInfos($siren)
{
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('interne');
try {
$reponse = $client->getGroupeInfos($params);
return $reponse->getGroupeInfosResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('Error')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getCountryId($code)
{
$params = new stdClass();
$params->codeCountry = $code;
$client = $this->loadClient('interne');
try {
$reponse = $client->getCountryId($params);
return $reponse->getCountryIdResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
}

View File

@ -0,0 +1,75 @@
<?php
class Scores_Ws_Pieces extends Scores_Ws_Abstract
{
/**
* Récupération des kbis
*/
public function getKbis($siren, $diffusion, $reference='')
{
$params = new StdClass;
$params->siren = $siren;
$params->diffusion = $diffusion;
$params->reference = $reference;
$client = $this->loadClient('pieces');
try {
$reponse = $client->getKbis($params);
return $reponse->getKbisResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('0000', 'MSG')) ){
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* Liste des bilans
* @param string $siren
* @todo : Cache
*/
public function getPiecesBilans($siren)
{
$params = new stdClass();
$params->identifiant = $siren;
$client = $this->loadClient('pieces');
try {
$reponse = $client->getBilans($params);
return $reponse->getBilansResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Bilan URL
* @param string $siren
* @param string $diffusion
* @param string $dateCloture
* @param string $reference
*/
public function getPiecesBilan($siren, $diffusion, $dateCloture, $reference)
{
$params = new stdClass();
$params->identifiant = $siren;
$params->diffusion = $diffusion;
$params->dateCloture = $dateCloture;
$params->reference = $reference;
$client = $this->loadClient('pieces');
try {
$reponse = $client->getBilan($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->getBilanResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}

View File

@ -0,0 +1,511 @@
<?php
class Scores_Ws_Saisie extends Scores_Ws_Abstract
{
/**
* getMandataire
* @param string $idMand
*/
public function getMandataire($idMand)
{
$params = new stdClass();
$params->id = $idMand;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getMandataire($params);
return $reponse->getMandataireResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* dupliqueAnnonce
* @param integer $source
* @param string $idAnn
* @param string $siretIn
* @param string $siretOut
* @return boolean
*/
public function dupliqueAnnonce($source, $idAnn, $siretIn = '', $siretOut = '')
{
$params = new stdClass();
$params->source= $source;
$params->idAnn= $idAnn;
$params->siretIn = $siretIn;
$params->siretOut = $siretOut;
$client = $this->loadClient('saisie');
try {
$reponse = $client->dupliqueAnnonce($params);
return $reponse->dupliqueAnnonceResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Enter description here ...
* @param string $siret
* @param integer $id
* @param array $infos
* @return boolean
*/
public function setInfosEntrep($siret, $id, $infos)
{
$params = new stdClass();
$params->siret = $siret;
$params->idEntreprise = $siret;
$params->infos = json_encode($infos);
$client = $this->loadClient('saisie');
try {
$reponse = $client->setInfosEntrep($params);
return $reponse->setInfosEntrepResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Enter description here ...
* @param unknown_type $idAnn
* @param unknown_type $siret
*/
public function supprAnnonceCollecte($idAnn, $siret = '')
{
$params = new stdClass();
$params->idAnn= $idAnn;
$params->siret= $siret;
$client = $this->loadClient('saisie');
try {
$reponse = $client->supprAnnonceCollecte($params);
return $reponse->supprAnnonceCollecteResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* supprAnnonce
* @param integer $source
* @param string $idAnn
* @param string $siret
*/
public function supprAnnonce($source, $idAnn, $siret = '')
{
$params = new stdClass();
$params->source= $source;
$params->idAnn= $idAnn;
$params->siret = $siret;
$client = $this->loadClient('saisie');
try {
$reponse = $client->supprAnnonce($params);
return $reponse->supprAnnonceResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Enter description here ...
* @param unknown_type $siren
* @param unknown_type $id
* @param unknown_type $codeEven
*/
public function setAnnonceEven($siren, $id, $codeEven)
{
$params = new stdClass();
$params->siren = $siren;
$params->id = $id;
$params->codeEven = $codeEven;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setAnnonceEven($params);
return $reponse->setAnnonceEvenResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function setActeAsso($siren, $waldec, $type, $libelle, $date)
{
$params = new stdClass();
$params->siren = $siren;
$params->waldec = $waldec;
$params->type = $type;
$params->libelle = $libelle;
$params->date = $date;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setActeAsso($params);
return $reponse->setActeAssoResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setBilan($siren, $unite, $dateCloture, $dureeMois, $dateCloturePre, $dureeMoisPre, $typeBilan, $postes, $step = 'normal')
{
$params = new stdClass();
$params->siren = $siren;
$params->data->unite = $unite;
$params->data->dateCloture = $dateCloture;
$params->data->dureeMois = $dureeMois;
$params->data->dateCloturePre = $dateCloturePre;
$params->data->dureeMoisPre = $dureeMoisPre;
$params->data->typeBilan = $typeBilan;
$params->data->postes = $postes;
$params->step = $step;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setBilan($params);
return $reponse->setBilanResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setLienRef($infos, $id = null)
{
$params = new stdClass();
$params->infos = $infos;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setLienRef($params);
return $reponse->setLienRefResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function searchLienRef($query, $type = null)
{
$params = new stdClass();
$params->query = $query;
$params->type = $type;
$client = $this->loadClient('saisie');
try {
$reponse = $client->searchLienRef($params);
return $reponse->searchLienRefResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setLienDoc($infos, $id = null)
{
$params = new stdClass();
$params->infos = $infos;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setLienDoc($params);
return $reponse->setLienDocResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function setLien($infos, $id = null)
{
$params = new stdClass();
$params->infos = $infos;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setLien($params);
return $reponse->setLienResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getSaisieLienRef($id)
{
$params = new stdClass();
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getLienRef($params);
return $reponse->getLienRefResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getSaisieLien($id)
{
$params = new stdClass();
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getLien($params);
return $reponse->getLienResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setBourse($isin, $infos)
{
$params = new stdClass();
$params->isin = $isin;
$params->infos = $infos;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setBourse($params);
return $reponse->setBourseResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getSaisieBourse($isin)
{
$params = new stdClass();
$params->isin = $isin;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getBourse($params);
return $reponse->getBourseResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* Get Score Cut Off
* @param string $siren
* @return Cutoff values or False
*/
public function getScoreCutoff($siren)
{
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getScoreCutoff($params);
return $reponse->getScoreCutoffResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
/**
* Delete Score Cut Off
* @param string $siren
* @return boolean
*/
public function delScoreCutoff($siren)
{
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('saisie');
try {
$reponse = $client->delScoreCutoff($params); //change name when webservice is ready
return $reponse->delScoreCutoffResult; //change name when webservice is ready
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
public function setLienChange($action, $idLien, $id)
{
$params = new stdClass();
$params->action = $action;
$params->idLien = $idLien;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setLienChange($params);
return $reponse->setLienChangeResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* Set Score Cut Off
* @param string $siren
* @param int $encours
* @param int $scoreSolv
* @param int $scoreDir
* @param int $scoreConf
* @param string $remarque
* @param boolean delete
* @return boolean
*/
public function setScoreCutoff($siren, $encours, $scoreSolv, $scoreDir, $scoreConf, $remarque, $delete)
{
$infos = array(
'siren' => $siren,
'encours' => $encours,
'scoreSolv' => $scoreSolv,
'scoreDir' => $scoreDir,
'scoreConf' => $scoreConf,
'remarque' => $remarque,
);
$params = new stdClass();
$params->infos = json_encode($infos);
$params->delete = $delete;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setScoreCutoff($params);
return $reponse->setScoreCutoffResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
public function getLienDoc($id, $type = null, $groupe = false)
{
$params = new stdClass();
$params->id = $id;
$params->type = $type;
$params->groupe = $groupes;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getLienDoc($params);
return $reponse->getLienDocResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getDirigeantsOp
* @param string $siren
*/
public function getDirigeantsOp($siren, $id = null)
{
$filename = 'dirigeantsop-'.$siren.'-'.intval($id);
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new StdClass();
$params->siren = $siren;
$params->id = $id;
$client = $this->loadClient('interne');
try {
$reponse = $client->getDirigeantsOp($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getDirigeantsOpResult);
}
return $reponse->getDirigeantsOpResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* setDirigeantsOp
* @param array $infos
*/
public function setDirigeantsOp($infos, $mode, $id)
{
$params = new stdClass();
$params->infos = $infos;
$params->mode = $mode;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setDirigeantsOp($params);
return $reponse->setDirigeantsOpResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
}

View File

@ -31,13 +31,13 @@ class WsScores
* Enable/Disable using of cache * Enable/Disable using of cache
* @var unknown * @var unknown
*/ */
protected $cacheEnable = false; protected $cacheEnable = true;
/** /**
* Enbale/Disable cache writing * Enbale/Disable cache writing
* @var boolean * @var boolean
*/ */
protected $cacheWrite = false; protected $cacheWrite = true;
/** /**
* Load WebService config * Load WebService config
@ -87,7 +87,7 @@ class WsScores
$options['login'] = $this->login; $options['login'] = $this->login;
$options['password'] = $this->password; $options['password'] = $this->password;
if (APPLICATION_ENV == 'development'){ if (APPLICATION_ENV == 'development'){
$options['cache_wsdl'] = WSDL_CACHE_NONE; $options['cache_wsdl'] = WSDL_CACHE_NONE;
} }
$options['trace'] = true; $options['trace'] = true;
$options['encoding'] = 'utf-8'; $options['encoding'] = 'utf-8';
@ -101,6 +101,154 @@ class WsScores
return $client; return $client;
} }
public function getEntrepriseLiasseInfos($siren)
{
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getLiasseInfos($params);
return $reponse->getLiasseInfosResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setSaisieContactEt($siret, $type, $value, $info, $id=null, $delete=false)
{
$params = new stdClass();
$params->id = $id;
$params->siret = $siret;
$params->type = $type;
$params->value = $value;
$params->info = $info;
$params->delete = $delete;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setContactEt($params);
return $reponse->setContactEtResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
public function getSaisieContactEt($id)
{
$params = new stdClass();
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getContactEt($params);
return $reponse->getContactEtResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
public function getContactEt($siret, $filter = null)
{
$filename = 'getcontactet-'.$siret;
if ( $filter !== null ) {
$filename.= '-'.$filter;
}
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new stdClass();
$params->siret = $siret;
$params->filtre = $filter;
$client = $this->loadClient('interne');
try {
$reponse = $client->getContactEt($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getContactEtResult);
}
return $reponse->getContactEtResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
*
* @param unknown $siren
* @param number $offset
* @param number $nbItems
* @return boolean
*/
public function getSubventionList($siren, $offset = 0, $nbItems = 100)
{
$params = new stdClass();
$params->companyId = $siren;
$params->offset = $offset;
$params->nbItems = $nbItems;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getSubventionList($params);
return $reponse->getSubventionListResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* Subvention Detail
* @param int $id
* @return boolean
*/
public function getSubventionDetail($id)
{
$params = new stdClass();
$params->id = $id;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getSubventionDetail($params);
return $reponse->getSubventionDetailResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
*
* @param unknown $siren
* @param number $nic
* @param number $niveau
* @return Ambigous <boolean, mixed>|boolean
*/
public function getEntrepriseValo($siren, $nic=0, $niveau=2) public function getEntrepriseValo($siren, $nic=0, $niveau=2)
{ {
$filename = 'getvalo-'.$siren.'-'.$nic.'-'.$niveau; $filename = 'getvalo-'.$siren.'-'.$nic.'-'.$niveau;
@ -230,6 +378,26 @@ class WsScores
} }
} }
public function getCatalogCity($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns = $columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getCity($params);
return $reponse->getCityResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getCatalogLegalForm($id, $columns) public function getCatalogLegalForm($id, $columns)
{ {
$params = new stdClass(); $params = new stdClass();
@ -779,13 +947,18 @@ class WsScores
/** /**
* Liste des bilans * Liste des bilans
* @param string $siren * @param string $identifiant
* @todo : Cache * Siren
* @param int $position
* @param int $nbRep
*
*/ */
public function getPiecesBilans($siren) public function getPiecesBilans($identifiant, $position = 0, $nbRep = 200)
{ {
$params = new stdClass(); $params = new stdClass();
$params->identifiant = $siren; $params->identifiant = $identifiant;
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->loadClient('pieces'); $client = $this->loadClient('pieces');
try { try {
$reponse = $client->getBilans($params); $reponse = $client->getBilans($params);
@ -800,16 +973,18 @@ class WsScores
/** /**
* Bilan URL * Bilan URL
* @param string $siren * @param string $siren
* @param string $type
* @param string $diffusion * @param string $diffusion
* @param string $dateCloture * @param string $dateCloture
* @param string $reference * @param string $reference
*/ */
public function getPiecesBilan($siren, $diffusion, $dateCloture, $reference) public function getPiecesBilan($siren, $type, $diffusion, $dateCloture, $reference = '')
{ {
$params = new stdClass(); $params = new stdClass();
$params->identifiant = $siren; $params->identifiant = $siren;
$params->diffusion = $diffusion;
$params->dateCloture = $dateCloture; $params->dateCloture = $dateCloture;
$params->type = $type;
$params->diffusion = $diffusion;
$params->reference = $reference; $params->reference = $reference;
$client = $this->loadClient('pieces'); $client = $this->loadClient('pieces');
try { try {
@ -823,6 +998,47 @@ class WsScores
} }
} }
public function getPiecesActe($siren, $diffusion, $depotNum, $depotDate, $acteType, $acteNum, $acteDate, $reference = '')
{
$params = new stdClass();
$params->identifiant = $siren;
$params->diffusion = $diffusion;
$params->depotNum = $depotNum;
$params->depotDate = $depotDate;
$params->acteType = $acteType;
$params->acteNum = $acteNum;
$params->acteDate = $acteDate;
$params->reference = $reference;
$client = $this->loadClient('pieces');
try {
$reponse = $client->getActe($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->getActeResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function getPiecesActes($identifiant, $position = 0, $nbRep = 200)
{
$params = new stdClass();
$params->identifiant = $identifiant;
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->loadClient('pieces');
try {
$reponse = $client->getActes($params);
return $reponse->getActesResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function setCGU() public function setCGU()
{ {
$params = new stdClass(); $params = new stdClass();
@ -856,6 +1072,54 @@ class WsScores
} }
} }
/**
* Get secondary email
* @param string $login
* @param int $id
* @return boolean
*/
public function getGestionEmail($login, $id=null)
{
$params = new stdClass();
$params->login = $login;
$params->id = $id;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getEmail($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->getEmailResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Set secondary email
* @param string $email
* @param login $login
* @param int $id
* @param string $action
* @return boolean
*/
public function setGestionEmail($email, $login, $id=null, $action = 'set')
{
$params = new stdClass();
$params->email = $email;
$params->login = $login;
$params->idClient = $idClient;
$params->id = $id;
$params->action = $action;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setEmail($params);
return $reponse->setEmailResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/** /**
* Retourne les infos du groupe * Retourne les infos du groupe
* @param string $siren * @param string $siren
@ -884,9 +1148,13 @@ class WsScores
* @param int pctMin * @param int pctMin
* @param int $nbNiveaux * @param int $nbNiveaux
*/ */
public function getGroupesArbo($siren, $pctMin=33, $nbNiveaux=10) public function getGroupesArbo($siren, $pctMin=33, $nbNiveaux=10, $stopAtIsin = false)
{ {
$filename = 'groupesarbo-'.$siren.'-'.$pctMin; $filename = 'groupesarbo-'.$siren.'-'.$pctMin;
$filename.= '-0';
if ($stopAtIsin === true) {
$filename.= '-1';
}
if ($this->cacheWrite) { if ($this->cacheWrite) {
$cache = new Cache($filename); $cache = new Cache($filename);
@ -898,7 +1166,7 @@ class WsScores
$params = new StdClass; $params = new StdClass;
$params->siren = $siren; $params->siren = $siren;
$params->pctMin = $pctMin; $params->pctMin = $pctMin;
$params->stopAtIsin = false; $params->stopAtIsin = $stopAtIsin;
$params->nbNiveaux = $nbNiveaux; $params->nbNiveaux = $nbNiveaux;
$client = $this->loadClient('interne'); $client = $this->loadClient('interne');
try { try {
@ -917,10 +1185,12 @@ class WsScores
/** /**
* Récupération des kbis * Récupération des kbis
*/ */
public function getKbis($siren) public function getKbis($siren, $diffusion, $reference='')
{ {
$params = new StdClass; $params = new StdClass;
$params->siren = $siren; $params->siren = $siren;
$params->diffusion = $diffusion;
$params->reference = $reference;
$client = $this->loadClient('pieces'); $client = $this->loadClient('pieces');
try { try {
$reponse = $client->getKbis($params); $reponse = $client->getKbis($params);
@ -2322,9 +2592,9 @@ class WsScores
* getDirigeantsOp * getDirigeantsOp
* @param string $siren * @param string $siren
*/ */
public function getDirigeantsOp($siren) public function getDirigeantsOp($siren, $id = null)
{ {
$filename = 'dirigeantsop-'.$siren; $filename = 'dirigeantsop-'.$siren.'-'.intval($id);
if ($this->cacheWrite) { if ($this->cacheWrite) {
$cache = new Cache($filename); $cache = new Cache($filename);
@ -2335,6 +2605,7 @@ class WsScores
$params = new StdClass(); $params = new StdClass();
$params->siren = $siren; $params->siren = $siren;
$params->id = $id;
$client = $this->loadClient('interne'); $client = $this->loadClient('interne');
try { try {
$reponse = $client->getDirigeantsOp($params); $reponse = $client->getDirigeantsOp($params);
@ -2349,6 +2620,31 @@ class WsScores
} }
} }
/**
* setDirigeantsOp
* @param array $infos
*/
public function setDirigeantsOp($infos, $mode, $id)
{
$params = new stdClass();
$params->infos = $infos;
$params->mode = $mode;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setDirigeantsOp($params);
return $reponse->setDirigeantsOpResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/** /**
* getIdentiteLight * getIdentiteLight
* @param string $siret * @param string $siret
@ -2741,6 +3037,26 @@ class WsScores
} }
} }
} }
/**
* getScoreHistorique pour les derniers 5 ans
* @param string $siret
* @param string $type
*/
public function getScoresHisto($siret, $type = 'indiscore')
{
$params = new stdClass();
$params->siret = $siret;
$params->type = $type;
try {
$client = $this->loadClient('interne');
$reponse = $client->getScoresHisto($params);
return $reponse->getScoresHistoResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/** /**
* getNextLogin * getNextLogin
@ -2885,13 +3201,15 @@ class WsScores
$message.= "Requete :\n ".$requete."\n"; $message.= "Requete :\n ".$requete."\n";
$message.= "Reponse :\n ".$reponse."\n"; $message.= "Reponse :\n ".$reponse."\n";
$c = Zend_Registry::get('config');
require_once 'Scores/Mail.php'; if (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'staging') {
$mail = new Mail(); $c = Zend_Registry::get('config');
$mail->setSubject('[ERREUR SOAP] - '.$c->profil->server->name.' -'.date('Ymd')); $mail = new Scores_Mail();
$mail->setBodyTexte($message); $mail->setSubject('[ERREUR SOAP] - '.$c->profil->server->name.' -'.date('Ymd'));
$mail->setFrom('supportdev'); $mail->setBodyTexte($message);
$mail->addToKey('supportdev'); $mail->setFrom('supportdev');
$mail->send(); $mail->addToKey('supportdev');
$mail->send();
}
} }
} }

View File

@ -0,0 +1,45 @@
<?php
// Generated by ZF's ./bin/classmap_generator.php
return array(
'Annonces' => dirname(__FILE__) . '//Annonces.php',
'Scores_Auth_Adapter_Db' => dirname(__FILE__) . '//Auth/Adapter/Db.php',
'Scores_Auth_Adapter_Ws' => dirname(__FILE__) . '//Auth/Adapter/Ws.php',
'BDF' => dirname(__FILE__) . '//Bdf.php',
'Cache' => dirname(__FILE__) . '//Cache.php',
'Scores_Export_ArrayCsv' => dirname(__FILE__) . '//Export/ArrayCsv.php',
'Scores_Export_Print' => dirname(__FILE__) . '//Export/Print.php',
'Scores_Finance_Liasse_XLS' => dirname(__FILE__) . '//Finance/Liasse/XLS.php',
'Scores_Finance_Liasse' => dirname(__FILE__) . '//Finance/Liasse.php',
'Scores_Finance_Ratios_Data' => dirname(__FILE__) . '//Finance/Ratios/Data.php',
'Scores_Finance_Ratios_Graph' => dirname(__FILE__) . '//Finance/Ratios/Graph.php',
'GestionCommande' => dirname(__FILE__) . '//GestionCommandes.php',
'Scores_Google_Maps' => dirname(__FILE__) . '//Google/Maps.php',
'Scores_Google_Streetview' => dirname(__FILE__) . '//Google/Streetview.php',
'IdentiteEntreprise' => dirname(__FILE__) . '//IdentiteEntreprise.php',
'IdentiteProcol' => dirname(__FILE__) . '//IdentiteProcol.php',
'Scores_Insee_AvisSituation' => dirname(__FILE__) . '//Insee/AvisSituation.php',
'Scores_Insee_Iris' => dirname(__FILE__) . '//Insee/Iris.php',
'Logo' => dirname(__FILE__) . '//Logo.php',
'Scores_Mail' => dirname(__FILE__) . '//Mail.php',
'Mappy' => dirname(__FILE__) . '//Mappy.php',
'Scores_Menu' => dirname(__FILE__) . '//Menu.php',
'Scores_Mobile_Detect' => dirname(__FILE__) . '//Mobile/Detect.php',
'RapportComment' => dirname(__FILE__) . '//RapportComment.php',
'Scores_Serializer_Adapter_Xml' => dirname(__FILE__) . '//Serializer/Adapter/Xml.php',
'Scores_Session_Entreprise' => dirname(__FILE__) . '//Session/Entreprise.php',
'Scores_Session_Recherche' => dirname(__FILE__) . '//Session/Recherche.php',
'Siren' => dirname(__FILE__) . '//Siren.php',
'Scores_Utilisateur' => dirname(__FILE__) . '//Utilisateur.php',
'Scores_Wkhtml_Pdf' => dirname(__FILE__) . '//Wkhtml/Pdf.php',
'Scores_Ws_Abstract' => dirname(__FILE__) . '//Ws/Abstract.php',
'Scores_Ws_Catalog' => dirname(__FILE__) . '//Ws/Catalog.php',
'Scores_Ws_Config' => dirname(__FILE__) . '//Ws/Config.php',
'Scores_Ws_Entreprise' => dirname(__FILE__) . '//Ws/Entreprise.php',
'Scores_Ws_Gestion' => dirname(__FILE__) . '//Ws/Gestion.php',
'Scores_Ws_Interface' => dirname(__FILE__) . '//Ws/Interface.php',
'Scores_Ws_Interne' => dirname(__FILE__) . '//Ws/Interne.php',
'Scores_Ws_Pieces' => dirname(__FILE__) . '//Ws/Pieces.php',
'Scores_Ws_Saisie' => dirname(__FILE__) . '//Ws/Saisie.php',
'Scores_Ws' => dirname(__FILE__) . '//Ws.php',
'WsScores' => dirname(__FILE__) . '//WsScores.php',
);

View File

@ -1,173 +0,0 @@
<?
if ( !function_exists('htmlspecialchars_decode') )
{
function htmlspecialchars_decode($text)
{
return strtr($text, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
}
}
require_once 'common/curl.php';
if ( !function_exists('supprDecimales') )
{
function supprDecimales($dec) {
if ($dec>0 )
return floor($dec);
else
return ceil($dec);
}
}
if ( !function_exists('dec2dms') )
{
function dec2dms($dec) {
$d = supprDecimales($dec);
$m = supprDecimales(($dec - $d) * 60);
$s = abs(round(((($dec - $d) * 60) - $m) * 60));
$m = abs($m);
return $d.'°'.$m."'".$s.'"';
}
}
/** Retourne la distance en kilomètres entre 2 points à la surface de la terre
** Calcul effectué avec la sphère « GRS80 » de rayon R = 6378,187 km
** Autre sphère possible : « Picard » de rayon R = 6371,598 km
**
** @param double $latA Latitude du point A en décimal
** @param double $lonA Longitude du point A en décimal
** @param double $latB Latitude du point B en décimal
** @param double $lonB Longitude du point B en décimal
** @return unknown
**/
function distance($latA=0, $lonA=0, $latB=0, $lonB=0) {
//s(AB) = arc cos (sinjA sinjB + cos jA cosjB cosdl)
// avec dl = lB - lA
$e=pi()*$latA/180;
$f=pi()*$lonA/180;
$g=pi()*$latB/180;
$h=pi()*$lonB/180;
$j=acos(cos($e)*cos($g)*cos($f)*cos($h) + cos($e)*sin($f)*cos($g)*sin($h) + sin($e)*sin($g));
return round(6371.598*$j,3); // div par 1.852 ==> résultat en miles nautiques
}
class MMap {
public $body = '';
public $header = '';
public $cookie = '';
public $codeRetour = 0;
public $codeRetour2 = 0;
public $latitudeDec= 0; // Latitude en Décimal
public $latitudeDeg= 0; // Latitude en Dégrés
public $longitudeDec= 0; // Longitude en Décimal
public $longitudeDeg= 0; // Longitude en Dégrés
public $precision = 0;
public $adresseValidee='';
function __construct($adresse, $cp, $ville, $pays='France') {
/*
$referer='http://maps.google.fr/?output=html';
$page=getUrl($referer, '', '', $referer, false, 'maps.google.fr');
$this->body=$page['body'];
$this->codeRetour=$page['code'];
$this->header=$page['header'];
$this->cookie=$this->header['Set-Cookie'];
$url='http://maps.google.fr/maps?f=q&output=html&q='.urlencode($adresse.', '.$cp.' '. $ville.', '.$pays);
$page=getUrl($url, $this->cookie, '', $referer, false, 'maps.google.fr');
$this->body=$page['body'];
$this->codeRetour=$page['code'];
$this->header=$page['header'];
if (strpos($this->body, '<p>Nous ne sommes pas parvenus à localiser l\'adresse : <br />')===true) return false;
$this->adresseValidee=strtoupper(htmlspecialchars_decode(str_replace('<br>', ', ', @getTextInHtml($this->body, '<p><table cellpadding="0" cellspacing="0" border="0"><tr><td valign="center" nowrap>', ' nowrap>', '</td>')), ENT_QUOTES));
$this->latitudeDec=@getTextInHtml($this->body, 'latitude_e6=', '=','&')/1000000;
$this->longitudeDec=@getTextInHtml($this->body, 'longitude_e6=', '=','&');
if ($this->longitudeDec>1000000000)
$this->longitudeDec=-(4294967293-$this->longitudeDec)/1000000;
else
$this->longitudeDec=$this->longitudeDec/1000000;
$this->latitudeDeg=dec2dms($this->latitudeDec);
$this->longitudeDeg=dec2dms($this->longitudeDec);
if ($this->codeRetour==200)
return true;
//$latitude_range = (180 * $range) / ($pi * $radius_of_earth);
//$longitude_range = (180 * $range) / ($pi * $radius_of_earth * sin((90 - $alat) * $pi / 180));
*/
$apiKey='ABQIAAAAuKBtUyFonYJBl1fqfc78tRQvADPcxwXf3Q2QIE-M32vuSkrxiBRLUHDB_YSLeTscTDeWRKM_wILaaw';
$url='http://maps.google.com/maps/geo?q='.urlencode($adresse.', '.$cp.' '. $ville.', '.$pays).'&output=xml&key='.$apiKey;
$referer='';//http://maps.google.fr/?output=html';
$page=getUrl($url, '', '', $referer, false, 'maps.google.com', '', 2);
$this->body=$page['body'];
$this->codeRetour=$page['code'];
$this->header=$page['header'];
//die($this->body=$page['body']);
//{"name":"3 rue viète, 75017 paris, france","Status":{"code":200,"request":"geocode"},"Placemark":[{"id":"p1","address":"3, Rue Viète, 75017 17ème Arrondissement, Paris, France","AddressDetails":{"Country":{"CountryNameCode":"FR","AdministrativeArea":{"AdministrativeAreaName":"Ile-de-France","SubAdministrativeArea":{"SubAdministrativeAreaName":"Paris","Locality":{"LocalityName":"Paris","DependentLocality":{"DependentLocalityName":"17ème Arrondissement","Thoroughfare":{"ThoroughfareName":"3, Rue Viète"},"PostalCode":{"PostalCodeNumber":"75017"}}}}}},"Accuracy": 8},"Point":{"coordinates":[2.306174,48.883705,0]}}]}
/*<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://earth.google.com/kml/2.0"><Response><name>3 rue viète, 75017 paris, france</name><Status><code>200</code><request>geocode</request></Status><Placemark id="p1"><address>3, Rue Viète, 75017 17ème Arrondissement, Paris, France</address><AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>FR</CountryNameCode><AdministrativeArea><AdministrativeAreaName>Ile-de-France</AdministrativeAreaName><SubAdministrativeArea><SubAdministrativeAreaName>Paris</SubAdministrativeAreaName><Locality><LocalityName>Paris</LocalityName><DependentLocality><DependentLocalityName>17ème Arrondissement</DependentLocalityName><Thoroughfare><ThoroughfareName>3, Rue Viète</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>75017</PostalCodeNumber></PostalCode></DependentLocality></Locality></SubAdministrativeArea></AdministrativeArea></Country></AddressDetails><Point><coordinates>2.306174,48.883705,0</coordinates></Point></Placemark></Response></kml>*/
/*
0 Unknown location. (Since 2.59)
1 Country level accuracy. (Since 2.59)
2 Region (state, province, prefecture, etc.) level accuracy. (Since 2.59)
3 Sub-region (county, municipality, etc.) level accuracy. (Since 2.59)
4 Town (city, village) level accuracy. (Since 2.59)
5 Post code (zip code) level accuracy. (Since 2.59)
6 Street level accuracy. (Since 2.59)
7 Intersection level accuracy. (Since 2.59)
8 Address level accuracy. (Since 2.59)
*/
$this->precision=@getTextInHtml($this->body, '<AddressDetails Accuracy', '="', ' ');
$this->adresseValidee=strtoupper(@getTextInHtml($this->body, '<address>', 'adress>', '</address>'));
$strTmp=@getTextInHtml($this->body, '<Point><coordinates>', '<coordinates>', '</coordinates>');
$tabTmp=explode(',', $strTmp);
if (isset($tabTmp[1]) == false) {
return false;
}
$this->latitudeDec = $tabTmp[1];
$this->longitudeDec = $tabTmp[0];
$this->latitudeDeg = dec2dms($this->latitudeDec);
$this->longitudeDeg = dec2dms($this->longitudeDec);
/*
200 G_GEO_SUCCESS No errors occurred; the address was successfully parsed and its geocode has been returned.
400 G_GEO_BAD_REQUEST A directions request could not be successfully parsed.
500 G_GEO_SERVER_ERROR A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.
601 G_GEO_MISSING_QUERY The HTTP q parameter was either missing or had no value. For geocoding requests, this means that an empty address was
specified as input. For directions requests, this means that no query was specified in the input.
602 G_GEO_UNKNOWN_ADDRESS No corresponding geographic location could be found for the specified address. This may be due to the fact that the address
is relatively new, or it may be incorrect.
603 G_GEO_UNAVAILABLE_ADDRESS The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual
reasons.
604 G_GEO_UNKNOWN_DIRECTIONS The GDirections object could not compute directions between the points mentioned in the query. This is usually because
there is no route available between the two points, or because we do not have data for routing in that region.
610 G_GEO_BAD_KEY The given key is either invalid or does not match the domain for which it was given.
620 G_GEO_TOO_MANY_QUERIES The given key has gone over the requests limit in the 24 hour period.
*/
if ($this->codeRetour2==200)
return true;
return false;
}
/* if (latnorth == 'S') latdir='-'
if (lonwest == 'W') longdir='-'
latdec=Math.round(lat1)+lat2/60
londec=Math.round(long1)+long2/60
gmdatalat=latdir+latdec.toFixed(6)
gmdatalon=longdir+londec.toFixed(6)
//GM_log( 'Latdec:'+gmdatalat+' LongDec:'+gmdatalon)
gmx=gmdatalat*Math.pow(10,6)
gmy=gmdatalon*Math.pow(10,6)
if (gmx < 0) gmx=gmx+Math.pow(2,32)*/
}
?>

View File

@ -1,29 +1,29 @@
[local] [local]
webservices.interne.wsdl = "http://webservice-2.4.sd.dev/interne/v0.6?wsdl-auto" webservices.interne.wsdl = "http://webservice-2.6.sd.dev/interne/v0.6?wsdl-auto"
webservices.interne.options.soap_version = SOAP_1_2 webservices.interne.options.soap_version = SOAP_1_2
webservices.entreprise.wsdl = "http://webservice-2.4.sd.dev/entreprise/v0.8?wsdl-auto" webservices.entreprise.wsdl = "http://webservice-2.6.sd.dev/entreprise/v0.8?wsdl-auto"
webservices.entreprise.options.soap_version = SOAP_1_2 webservices.entreprise.options.soap_version = SOAP_1_2
webservices.gestion.wsdl = "http://webservice-2.4.sd.dev/gestion/v0.3?wsdl-auto" webservices.gestion.wsdl = "http://webservice-2.6.sd.dev/gestion/v0.3?wsdl-auto"
webservices.gestion.options.soap_version = SOAP_1_2 webservices.gestion.options.soap_version = SOAP_1_2
webservices.saisie.wsdl = "http://webservice-2.4.sd.dev/saisie/v0.2?wsdl-auto" webservices.saisie.wsdl = "http://webservice-2.6.sd.dev/saisie/v0.2?wsdl-auto"
webservices.saisie.options.soap_version = SOAP_1_2 webservices.saisie.options.soap_version = SOAP_1_2
webservices.pieces.wsdl = "http://webservice-2.4.sd.dev/pieces/v0.1?wsdl-auto" webservices.pieces.wsdl = "http://webservice-2.6.sd.dev/pieces/v0.1?wsdl-auto"
webservices.pieces.options.soap_version = SOAP_1_2 webservices.pieces.options.soap_version = SOAP_1_2
webservices.catalog.wsdl = "http://webservice-2.4.sd.dev/catalog/v0.1?wsdl-auto" webservices.catalog.wsdl = "http://webservice-2.6.sd.dev/catalog/v0.1?wsdl-auto"
webservices.catalog.options.soap_version = SOAP_1_2 webservices.catalog.options.soap_version = SOAP_1_2
[sdsrvdev01] [sdsrvdev01]
webservices.interne.wsdl = "http://webservice-2.4.sd.lan/interne/v0.6?wsdl-auto" webservices.interne.wsdl = "http://webservice-2.6.sd.lan/interne/v0.6?wsdl-auto"
webservices.interne.options.soap_version = SOAP_1_2 webservices.interne.options.soap_version = SOAP_1_2
webservices.entreprise.wsdl = "http://webservice-2.4.sd.lan/entreprise/v0.8?wsdl-auto" webservices.entreprise.wsdl = "http://webservice-2.6.sd.lan/entreprise/v0.8?wsdl-auto"
webservices.entreprise.options.soap_version = SOAP_1_2 webservices.entreprise.options.soap_version = SOAP_1_2
webservices.gestion.wsdl = "http://webservice-2.4.sd.lan/gestion/v0.3?wsdl-auto" webservices.gestion.wsdl = "http://webservice-2.6.sd.lan/gestion/v0.3?wsdl-auto"
webservices.gestion.options.soap_version = SOAP_1_2 webservices.gestion.options.soap_version = SOAP_1_2
webservices.saisie.wsdl = "http://webservice-2.4.sd.lan/saisie/v0.2?wsdl-auto" webservices.saisie.wsdl = "http://webservice-2.6.sd.lan/saisie/v0.2?wsdl-auto"
webservices.saisie.options.soap_version = SOAP_1_2 webservices.saisie.options.soap_version = SOAP_1_2
webservices.pieces.wsdl = "http://webservice-2.4.sd.lan/pieces/v0.1?wsdl-auto" webservices.pieces.wsdl = "http://webservice-2.6.sd.lan/pieces/v0.1?wsdl-auto"
webservices.pieces.options.soap_version = SOAP_1_2 webservices.pieces.options.soap_version = SOAP_1_2
webservices.catalog.wsdl = "http://webservice-2.4.sd.lan/catalog/v0.1?wsdl-auto" webservices.catalog.wsdl = "http://webservice-2.6.sd.lan/catalog/v0.1?wsdl-auto"
webservices.catalog.options.soap_version = SOAP_1_2 webservices.catalog.options.soap_version = SOAP_1_2
[sd-25137] [sd-25137]