1101 lines
30 KiB
PHP
1101 lines
30 KiB
PHP
<?php
|
|
require_once realpath(dirname(__FILE__)).'/Cache.php';
|
|
require_once realpath(dirname(__FILE__)).'/Utilisateur.php';
|
|
|
|
class WsScores
|
|
{
|
|
protected $webservices = array();
|
|
protected $login = '';
|
|
protected $password = '';
|
|
protected $nbReponses = 20;
|
|
protected $toNotCache = false;
|
|
|
|
public function __construct($login = '', $password = '')
|
|
{
|
|
$config = new Zend_Config_Ini(APPLICATION_PATH .
|
|
'/configs/webservices.ini', APPLICATION_ENV);
|
|
$this->webservices = $config->webservices->toArray();
|
|
|
|
if ( !empty($login) && !empty($password) ){
|
|
$this->login = $login;
|
|
$this->password = $password;
|
|
} else {
|
|
$user = new Utilisateur();
|
|
$this->login = $user->getLogin();
|
|
$this->password = md5($user->getLogin().'|'.$user->getPassword());
|
|
$this->nbReponses = $user->getNbRep();
|
|
if ( $user->checkModeEdition() ) {
|
|
$this->toNotCache = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getRapport
|
|
* @param unknown_type $siren
|
|
* @param unknown_type $niveau
|
|
* @param unknown_type $id
|
|
*/
|
|
public function getRapport($siren, $niveau=3, $id=0)
|
|
{
|
|
$filename = 'getrapport-'.$siren.'-'.$niveau.'-'.$id;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->niveau = $niveau;
|
|
$params->id = $id;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getRapport($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getRapportResult);
|
|
return $reponse->getRapportResult;
|
|
} catch (SoapFault $fault) {
|
|
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;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getPortefeuilleCsv($params);
|
|
return $reponse->getPortefeuilleCsvResult;
|
|
} catch (SoapFault $fault) {
|
|
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) {
|
|
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('interne');
|
|
try {
|
|
$reponse = $client->getLogsClients($params);
|
|
return $reponse->getLogsClientsResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* getIndiScore
|
|
* @param string $siren
|
|
* @param string $nic
|
|
* @param integer $niveau
|
|
* @param boolean $plus
|
|
*/
|
|
public function getIndiScore($siren, $nic=0, $niveau=2, $plus=false)
|
|
{
|
|
$filename = 'getindiscore-'.$siren.'-'.$nic.'-'.$niveau;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->nic = $nic;
|
|
$params->niveau = $niveau;
|
|
$params->plus = $plus;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getIndiScore($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getIndiScoreResult);
|
|
return $reponse->getIndiScoreResult;
|
|
} catch (SoapFault $fault) {
|
|
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 = $idClient;
|
|
$params->siret = $siret;
|
|
$params->ref = $ref;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->setLog($params);
|
|
return true;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getListeClients
|
|
* @param unknown_type $idClient
|
|
*/
|
|
public function getListeClients($idClient=0)
|
|
{
|
|
$params = new stdClass();
|
|
$params->idClient = $idClient;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getListeClients($params);
|
|
return $reponse->getListeClientsResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* setMandataire
|
|
* Enter description here ...
|
|
* @param unknown_type $infos
|
|
*/
|
|
public function setMandataire($infos)
|
|
{
|
|
$params = new stdClass();
|
|
$params->id = $infos['id'];
|
|
$params->sirenGrp = $infos['sirenGrp'];
|
|
$params->sirenMand = $infos['sirenMand'];
|
|
$params->Nom = $infos['Nom'];
|
|
$params->Prenom = $infos['Prenom'];
|
|
$params->type = $infos['type'];
|
|
$params->stagiaire = $infos['stagiaire'];
|
|
$params->coursAppel = $infos['coursAppel'];
|
|
$params->coursAppel2 = $infos['coursAppel2'];
|
|
$params->tribunal = $infos['tribunal'];
|
|
$params->Statut = $infos['Statut'];
|
|
$params->adresse = $infos['adresse'];
|
|
$params->adresseComp = $infos['adresseComp'];
|
|
$params->cp = $infos['cp'];
|
|
$params->ville = $infos['ville'];
|
|
$params->tel = $infos['tel'];
|
|
$params->fax = $infos['fax'];
|
|
$params->email = $infos['email'];
|
|
$params->web = $infos['web'];
|
|
$params->contact = $infos['contact'];
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->setMandataire($params);
|
|
return $reponse->setMandataireResult;
|
|
} catch (SoapFault $fault) {
|
|
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) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* searchMandataires
|
|
* Enter description here ...
|
|
* @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) {
|
|
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) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getListeJalCollecte
|
|
* Enter description here ...
|
|
*/
|
|
public function getListeJalCollecte()
|
|
{
|
|
$filename = 'listejalcollecte';
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new stdClass();
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getListeJalCollecte();
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getListeJalCollecteResult);
|
|
return $reponse->getListeJalCollecteResult;
|
|
} catch (SoapFault $fault) {
|
|
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) {
|
|
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) {
|
|
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) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* setSurveillance
|
|
* Enter description here ...
|
|
* @param string $siret
|
|
* @param string $email
|
|
* @param string $ref
|
|
* @param string $source
|
|
* @param boolean $delete
|
|
* @param integer $encoursClient
|
|
*/
|
|
public function setSurveillance($siret, $email, $ref = '', $source='annonces', $delete=false, $encoursClient=0)
|
|
{
|
|
$params = new stdClass();
|
|
$params->siret = $siret;
|
|
$params->email = $email;
|
|
$params->ref = $ref;
|
|
$params->source = $source;
|
|
$params->delete = $delete;
|
|
$params->encoursClient = $encoursClient;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->setSurveillance($params);
|
|
return $reponse->setSurveillanceResult;
|
|
} catch (SoapFault $fault) {
|
|
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('interne');
|
|
try {
|
|
$reponse = $client->getListeUtilisateurs($params);
|
|
return $reponse->getListeUtilisateursResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getMarques
|
|
* Enter description here ...
|
|
* @param string $siren
|
|
* @param integer $idDepot
|
|
*/
|
|
public function getMarques($siren, $idDepot = 0)
|
|
{
|
|
$filename = 'marques-'.$siren.'-'.$idDepot;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->idDepot = $idDepot;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getMarques($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getMarquesResult);
|
|
return $reponse->getMarquesResult;
|
|
} catch (SoapFault $fault) {;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getListeConventions
|
|
* Enter description here ...
|
|
* @param string $siren
|
|
*/
|
|
public function getListeConventions($siren)
|
|
{
|
|
$filename = 'conventions-'.$siren;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getListeConventions($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getListeConventionsResult);
|
|
return $reponse->getListeConventionsResult;
|
|
} catch (SoapFault $fault) {;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getListeCompetences
|
|
* Enter description here ...
|
|
* @param string $siret
|
|
* @param string $type
|
|
* @param string $codeInsee
|
|
*/
|
|
public function getListeCompetences($siret, $type, $codeInsee)
|
|
{
|
|
$filename = 'competences-'.$siret.'-'.$type.'-'.$codeInsee;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new stdClass();
|
|
$params->siret = $siret;
|
|
$params->type = $type;
|
|
$params->codeInsee = $codeInsee;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getListeCompetences($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getListeCompetencesResult);
|
|
return $reponse->getListeCompetencesResult;
|
|
} catch (SoapFault $fault) {;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getInfosReg
|
|
* @param string $siren
|
|
* @param mixed $id
|
|
*/
|
|
public function getInfosReg($siren, $id = false)
|
|
{
|
|
$filename = 'infosreg-'.$siren.'-'.$id;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->id = $id;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getInfosReg($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getInfosRegResult);
|
|
return $reponse->getInfosRegResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getAnnonces
|
|
* @param string $siren
|
|
* @param integer $filtre
|
|
* @param string $idAnn
|
|
* @param integer $position
|
|
* @param integer $nbRep
|
|
*/
|
|
public function getAnnonces($siren, $filtre=0, $idAnn='', $position=0, $nbRep=100)
|
|
{
|
|
$filename = 'annonces-'.$siren.'-'.$filtre.'-'.$idAnn.'-'.$position.'-'.$nbRep;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->filtre = $filtre;
|
|
$params->idAnn = $idAnn;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getAnnonces($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getAnnoncesResult);
|
|
return $reponse->getAnnoncesResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* isSirenExistant
|
|
* @param string $siren
|
|
*/
|
|
public function isSirenExistant($siren)
|
|
{
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->isSirenExistant($params);
|
|
return $reponse->isSirenExistantResult;
|
|
} catch (SoapFault $fault) {
|
|
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) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getSurveillances
|
|
* @param string $siret
|
|
* @param string $source
|
|
* @param boolean $detail
|
|
* @param integer $deb
|
|
* @param integer $nbRep
|
|
* @param string $tri
|
|
*/
|
|
public function getSurveillances($tri='siren', $source='', $siret='', $detail=false, $deb=0, $nbRep=100)
|
|
{
|
|
$params = new StdClass;
|
|
$params->filtre = new StdClass;
|
|
$params->filtre->siret = $siret;
|
|
$params->filtre->source = $source;
|
|
$params->filtre->detail = $detail;
|
|
$params->filtre->tri = $tri;
|
|
$params->position = $deb;
|
|
$params->nbRep = $nbRep;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getSurveillances($params);
|
|
return $reponse->getSurveillancesResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getListeBilans
|
|
* @param string $siren
|
|
*/
|
|
public function getListeBilans($siren)
|
|
{
|
|
$filename = 'listebilans-'.$siren;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new StdClass;
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getListeBilans($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getListeBilansResult);
|
|
return $reponse->getListeBilansResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getBilan
|
|
* @param string $siren
|
|
* @param unknown_type $millesime
|
|
* @param unknown_type $typeBilan
|
|
* @param unknown_type $ref
|
|
*/
|
|
public function getBilan($siren, $millesime, $typeBilan, $ref)
|
|
{
|
|
$filename = 'bilan-'.$siren.'-'.$millesime.'-'.$typeBilan.'-'.$ref;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new StdClass;
|
|
$params->siren = $siren;
|
|
$params->millesime = $millesime;
|
|
$params->typeBilan = $typeBilan;
|
|
$params->ref = $ref;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getBilan($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getBilanResult);
|
|
return $reponse->getBilanResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getBanques
|
|
* @param string $siren
|
|
*/
|
|
public function getBanques($siren)
|
|
{
|
|
$filename = 'banques-'.$siren;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new StdClass;
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getBanques($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getBanquesResult);
|
|
return $reponse->getBanquesResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getInfosBourse
|
|
* @param string $siren
|
|
*/
|
|
public function getInfosBourse($siren)
|
|
{
|
|
$filename = 'infosbourse-'.$siren;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new StdClass;
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getInfosBourse($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getInfosBourseResult);
|
|
return $reponse->getInfosBourseResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getRatios
|
|
* @param string $siren
|
|
* @param string $page
|
|
*/
|
|
public function getRatios($siren, $page = 'ratios')
|
|
{
|
|
$filename = 'ratios-'.$siren.'-'.$page;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new StdClass();
|
|
$params->siren = $siren;
|
|
$params->page = $page;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getRatios($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getRatiosResult);
|
|
return $reponse->getRatiosResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* getDirigeants
|
|
* @param string $siren
|
|
* @param boolean $histo
|
|
*/
|
|
public function getDirigeants($siren, $histo=false)
|
|
{
|
|
$filename = 'dirigeants-'.$siren.'-'.$histo;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new StdClass();
|
|
$params->siren = $siren;
|
|
$params->histo = $histo;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getDirigeants($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getDirigeantsResult);
|
|
return $reponse->getDirigeantsResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getIdentite
|
|
* @param string $siret
|
|
* @param int $id
|
|
* @return mixed
|
|
*/
|
|
public function getIdentite($siret, $id = 0)
|
|
{
|
|
$filename = 'identite-'.$siret.'-'.$id;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new StdClass();
|
|
$params->siret = $siret;
|
|
$params->id = $id;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getIdentite($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getIdentiteResult);
|
|
return $reponse->getIdentiteResult;
|
|
} catch (SoapFault $fault) {
|
|
throw new Zend_Soap_Client_Exception($fault);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
*
|
|
* getLiens
|
|
* @param string $siren
|
|
* @return mixed
|
|
*/
|
|
public function getLiens($siren)
|
|
{
|
|
$filename = 'liens-'.$siren;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new StdClass();
|
|
$params->siren = $siren;
|
|
$params->actifsUniquement = true;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getLiens($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getLiensResult);
|
|
return $reponse->getLiensResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getListeEvenements
|
|
* @param string $siren
|
|
* @param string $nic
|
|
* @param integer $position
|
|
* @param integer $nbRep
|
|
* @return mixed
|
|
*/
|
|
public function getListeEvenements($siren, $nic=0, $position=0, $nbRep=200)
|
|
{
|
|
$filename = 'listeevenements-'.$siren.'-'.$nic.'-'.$position.'-'.$nbRep;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->nic = $nic;
|
|
$params->position = $position;
|
|
$params->nbRep = $nbRep;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getListeEvenements($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getListeEvenementsResult);
|
|
return $reponse->getListeEvenementsResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* getListeEtablissements
|
|
* @param string $siren
|
|
* @return mixed
|
|
*/
|
|
public function getListeEtablissements($siren, $actif = -1)
|
|
{
|
|
$filename = 'listeetablissements-'.$siren.'-'.actif;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('element');
|
|
}
|
|
$params = new StdClass();
|
|
$params->siren = $siren;
|
|
$params->dep = 0;
|
|
$params->actif = $actif;
|
|
$params->position = 0;
|
|
$params->nbRep = 100;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getListeEtablissements($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock('element', $reponse->getListeEtablissementsResult);
|
|
return $reponse->getListeEtablissementsResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* rechercheEntreprise
|
|
* @param unknown_type $type
|
|
* @param unknown_type $criteres
|
|
* @param unknown_type $position
|
|
*/
|
|
public function rechercheEntreprise($type, $criteres, $position = 0)
|
|
{
|
|
$params = new StdClass;
|
|
$params->type = $type;
|
|
$params->position = $position;
|
|
$params->nbRep = $this->nbReponses;
|
|
|
|
if ($type == 'ent') {
|
|
$criteresEntreprise = new StdClass;
|
|
$criteresEntreprise->identifiant = $criteres['identifiant'];
|
|
$criteresEntreprise->raisonSociale = $criteres['raisonSociale'];
|
|
$criteresEntreprise->adresse = $criteres['adresse'];
|
|
$criteresEntreprise->codePostal = $criteres['codePostal'];
|
|
$criteresEntreprise->ville = $criteres['ville'];
|
|
$criteresEntreprise->telFax = $criteres['telFax'];
|
|
$criteresEntreprise->naf = $criteres['naf'];
|
|
$criteresEntreprise->siege = false;
|
|
$criteresEntreprise->actif = false;
|
|
|
|
$criteresDirigeant = new StdClass;
|
|
$criteresDirigeant->nom = '';
|
|
$criteresDirigeant->prenom = '';
|
|
$criteresDirigeant->dateNaiss = '';
|
|
$criteresDirigeant->lieuNaiss = '';
|
|
|
|
} else if ($type == 'dir') {
|
|
$criteresEntreprise = new StdClass;
|
|
$criteresEntreprise->identifiant = '';
|
|
$criteresEntreprise->raisonSociale = '';
|
|
$criteresEntreprise->adresse = '';
|
|
$criteresEntreprise->codePostal = '';
|
|
$criteresEntreprise->ville = '';
|
|
$criteresEntreprise->telFax = '';
|
|
$criteresEntreprise->naf = '';
|
|
$criteresEntreprise->siege = false;
|
|
$criteresEntreprise->actif = false;
|
|
|
|
$criteresDirigeant = new StdClass;
|
|
$criteresDirigeant->nom = $criteres['dirNom'];
|
|
$criteresDirigeant->prenom = $criteres['dirPrenom'];
|
|
$criteresDirigeant->dateNaiss = $criteres['dirDateNaissJJ'];
|
|
$criteresDirigeant->lieuNaiss = $criteres['lieuNaiss'];
|
|
}
|
|
$params->criteres = new StdClass;
|
|
$params->criteres->elementEntreprise = $criteresEntreprise;
|
|
$params->criteres->elementDirigeant = $criteresDirigeant;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->rechercheEntreprise($params);
|
|
return $reponse->rechercheEntrepriseResult;
|
|
} catch (SoapFault $fault) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* setInfosLogin
|
|
* @param string $login
|
|
* @param string $action
|
|
* @param object $infos
|
|
*/
|
|
public function setInfosLogin($login, $action, $infos = null)
|
|
{
|
|
$params = new stdClass();
|
|
$params->login = $login;
|
|
$params->action = $action;
|
|
$params->infos = $infos;
|
|
try {
|
|
$client = $this->loadClient('interne');
|
|
$reponse = $client->setInfosLogin($params);
|
|
return $reponse->setInfosLoginResult;
|
|
} catch (SoapFault $fault) {
|
|
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('interne');
|
|
$reponse = $client->getInfosLogin($params);
|
|
return $reponse->getInfosLoginResult;
|
|
} catch (SoapFault $fault) {
|
|
Zend_Registry::get('firebug')->info($fault);
|
|
//Placer exception pour affichage message
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getNextLogin
|
|
* @param unknown_type $login
|
|
*/
|
|
public function getNextLogin($login)
|
|
{
|
|
$params = new stdClass();
|
|
$params->login = $login;
|
|
try {
|
|
$client = $this->loadClient('interne');
|
|
$reponse = $client->getNextLogin($params);
|
|
return $reponse->getNextLoginResult;
|
|
} catch (SoapFault $fault) {
|
|
//Placer exception pour affichage message
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getListePrefs
|
|
*/
|
|
public function getListePrefs()
|
|
{
|
|
$filename = 'prefs';
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('prefs');
|
|
}
|
|
try {
|
|
$client = $this->loadClient('interne');
|
|
$reponse = $client->getListePrefs();
|
|
$cache->deletefile();
|
|
$cache->setBlock('prefs', $reponse->getListePrefsResult);
|
|
return $reponse->getListePrefsResult;
|
|
} catch (SoapFault $fault) {
|
|
//Placer exception pour affichage message
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getListeDroits
|
|
*/
|
|
public function getListeDroits()
|
|
{
|
|
$filename = 'droits';
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock('droits');
|
|
}
|
|
try {
|
|
$client = $this->loadClient('interne');
|
|
$reponse = $client->getListeDroits();
|
|
$cache->deletefile();
|
|
$cache->setBlock('droits', $reponse->getListeDroitsResult);
|
|
return $reponse->getListeDroitsResult;
|
|
} catch (SoapFault $fault) {
|
|
//Placer exception pour affichage message
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* soaperror
|
|
* @param unknown_type $requete
|
|
* @param unknown_type $reponse
|
|
* @param unknown_type $fault
|
|
*/
|
|
protected function soaperror($requete, $reponse, $fault)
|
|
{
|
|
$message = '';
|
|
// Quel machine ....
|
|
$mail = new Zend_Mail();
|
|
$mail->setBodyText('Ceci est le texte du message.');
|
|
$mail->setSubject('TestSubject');
|
|
$mail->setFrom('supportdev@scores-decisions.com', 'SERVEUR');
|
|
$mail->addTo('supportdev@scores-decisions.com', 'Support DEV');
|
|
$mail->send();
|
|
}
|
|
|
|
/**
|
|
* loadClient
|
|
* @param unknown_type $webservice
|
|
*/
|
|
protected function loadClient($webservice)
|
|
{
|
|
$wsdl = $this->webservices[$webservice]['wsdl'];
|
|
$options = $this->webservices[$webservice]['options'];
|
|
$options['features'] = SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS;
|
|
$options['login'] = $this->login;
|
|
$options['password'] = $this->password;
|
|
if (APPLICATION_ENV != 'production'){
|
|
$options['cache_wsdl'] = WSDL_CACHE_NONE;
|
|
}
|
|
$options['trace'] = true;
|
|
$options['encoding'] = 'utf-8';
|
|
$client = new SoapClient($wsdl, $options);
|
|
return $client;
|
|
}
|
|
}
|
|
|