2240 lines
68 KiB
PHP
2240 lines
68 KiB
PHP
<?php
|
|
require_once realpath(dirname(__FILE__)).'/Cache.php';
|
|
|
|
class WsScores
|
|
{
|
|
protected $webservices = array();
|
|
protected $login = '';
|
|
protected $password = '';
|
|
protected $nbReponses = 20;
|
|
protected $toNotCache = false;
|
|
|
|
public function __construct($login = '', $password = '')
|
|
{
|
|
$configuration = Zend_Registry::get('configuration');
|
|
$location = $configuration->webservice->location;
|
|
$c = new Zend_Config_Ini(APPLICATION_PATH . '/configs/webservices.ini');
|
|
$config = $c->toArray();
|
|
if (APPLICATION_ENV == 'staging' && array_key_exists($location.'-staging', $config)) {
|
|
$location.= '-staging';
|
|
}
|
|
$this->webservices = $config[$location]['webservices'];
|
|
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() ) {
|
|
$this->toNotCache = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public function setClientTarif($idClient, $log, $service, $type, $priceUnit, $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->getClientsTarifsResult;
|
|
} 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, $code, $label)
|
|
{
|
|
$params = new stdClass();
|
|
$params->idClient = $idClient;
|
|
$params->code = $code;
|
|
$params->label = $label;
|
|
$client = $this->loadClient('gestion');
|
|
try {
|
|
$reponse = $client->setServices($params);
|
|
return $reponse->setServicesResult;
|
|
} 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 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;
|
|
}
|
|
}
|
|
}
|
|
|
|
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 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 getLienRef($id)
|
|
{
|
|
$params = new stdClass();
|
|
$params->id = $id;
|
|
$client = $this->loadClient('entreprise');
|
|
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 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)
|
|
{
|
|
$params = new stdClass();
|
|
$params->query = $query;
|
|
$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 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;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Liste des bilans
|
|
* @param string $siren
|
|
* @todo : Cache
|
|
*/
|
|
public function getPiecesBilans($siren)
|
|
{
|
|
$params = new stdClass();
|
|
$params->siren = $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->siren = $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;
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Retourne l'arborescence d'un groupe
|
|
* @param string $siren
|
|
* @param int $nbNiveaux
|
|
*/
|
|
public function getGroupesArbo($siren, $pctMin=33, $nbNiveaux=10)
|
|
{
|
|
$filename = 'groupesarbo-'.$siren;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new StdClass;
|
|
$params->siren = $siren;
|
|
$params->pctMin = $pctMin;
|
|
$params->nbNiveaux = $nbNiveaux;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getGroupesArbo($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getGroupesArboResult);
|
|
return $reponse->getGroupesArboResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Récupération des kbis
|
|
*/
|
|
public function getKbis($siren)
|
|
{
|
|
$params = new StdClass;
|
|
$params->siren = $siren;
|
|
$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;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Recherche par référence client
|
|
* @param string $search
|
|
* @param integer $position
|
|
* @param integer $nbRep
|
|
*/
|
|
public function searchRefClient($search, $position=0, $nbRep=20)
|
|
{
|
|
$params = new stdClass();
|
|
$params->search = $search;
|
|
$params->position = $position;
|
|
$params->nbRep = $nbRep;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->searchRefClient($params);
|
|
return $reponse->searchRefClientResult;
|
|
} 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;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getListeDepots($params);
|
|
$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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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 $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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getRapport
|
|
* @param string $siren
|
|
* @param integer $niveau
|
|
* @param integer $id
|
|
* @param boolean $plus
|
|
* @param string $ref
|
|
* @param integer $encours
|
|
* @param string $email
|
|
*/
|
|
public function getRapport($siren, $niveau=3, $id=0, $plus=false, $ref='', $encours=0, $email='')
|
|
{
|
|
$filename = 'getrapport-'.$siren.'-'.$niveau.'-'.$id;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->niveau = $niveau;
|
|
$params->id = $id;
|
|
$params->plus = $plus;
|
|
$params->ref = $ref;
|
|
$params->encours = $encours;
|
|
$params->email = $email;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
ini_set('default_socket_timeout', 600);
|
|
set_time_limit(300);
|
|
$reponse = $client->getRapport($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getRapportResult);
|
|
return $reponse->getRapportResult;
|
|
} 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
|
|
$configuration = Zend_Registry::get('configuration');
|
|
$location = $configuration->webservice->location;
|
|
$c = new Zend_Config_Ini(APPLICATION_PATH . '/configs/webservices.ini');
|
|
$config = $c->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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 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='')
|
|
{
|
|
$filename = 'getindiscore-'.$siren.'-'.$nic.'-'.$niveau;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->nic = $nic;
|
|
$params->niveau = $niveau;
|
|
$params->plus = $plus;
|
|
$params->ref = $ref;
|
|
$params->encours = $encours;
|
|
$params->email = $email;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getIndiScore($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getIndiScoreResult);
|
|
return $reponse->getIndiScoreResult;
|
|
} 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getMandataire
|
|
* @param string $idMand
|
|
*/
|
|
public function getMandataire($idMand)
|
|
{
|
|
$params = new stdClass();
|
|
$params->idMand = $idMand;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getMandataire($params);
|
|
return $reponse->getMandataireResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Recherche Annonce
|
|
* @param string $source
|
|
* @param string $dateAnnee
|
|
* @param integer $numParution
|
|
* @param integer $numAnnonce
|
|
*/
|
|
public function rechercheAnnonce($source, $dateAnnee, $numParution, $numAnnonce)
|
|
{
|
|
$params = new stdClass();
|
|
$params->source = $source;
|
|
$params->dateAnnee = $dateAnnee;
|
|
$params->numParution = $numParution;
|
|
$params->numAnnonce = $numAnnonce;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->rechercheAnnonce($params);
|
|
return $reponse->rechercheAnnonceResult;
|
|
} 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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)
|
|
{
|
|
$params = new stdClass();
|
|
$params->criteres->nom = $criteres['dirNom'];
|
|
$params->criteres->prenom = $criteres['dirPrenom'];
|
|
$params->criteres->dateNaiss = $criteres['dirDateNaiss'];
|
|
$params->criteres->lieuNaiss = $criteres['lieuNaiss'];
|
|
$params->criteres->pertinence = ($criteres['pertinence']===true) ? true : false ;
|
|
$params->deb = $deb;
|
|
$params->nbRep = $nbRep;
|
|
$params->maxRep = $maxRep;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->searchDir($params);
|
|
return $reponse->searchDirResult;
|
|
} 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;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 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->toNotCache ){
|
|
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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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) {
|
|
$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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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();
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->idDepot = $idDepot;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getMarques($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getMarquesResult);
|
|
return $reponse->getMarquesResult;
|
|
} 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;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getListeConventions($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getListeConventionsResult);
|
|
return $reponse->getListeConventionsResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
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();
|
|
}
|
|
$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($reponse->getListeCompetencesResult);
|
|
return $reponse->getListeCompetencesResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
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();
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->id = $id;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getInfosReg($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getInfosRegResult);
|
|
return $reponse->getInfosRegResult;
|
|
} catch (SoapFault $fault) {
|
|
if ($fault->faultcode=='1030'){
|
|
return $fault->faultstring;
|
|
} else {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
public function getAnnoncesNum($siren)
|
|
{
|
|
$filename = 'annoncesnum-'.$siren;
|
|
$cache = new Cache($filename);
|
|
if ( $cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getAnnoncesNum($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getAnnoncesNumResult);
|
|
return $reponse->getAnnoncesNumResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function getAnnoncesBalo($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
|
|
{
|
|
$filename = 'annoncesbalo-'.$siren.'-'.$idAnn.'-'.$position.'-'.$nbRep;
|
|
$cache = new Cache($filename);
|
|
if ( $cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->idAnn = $idAnn;
|
|
$params->filtre = $filtre;
|
|
$params->position = $position;
|
|
$params->nbRep = $nbRep;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getAnnoncesBalo($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getAnnoncesBaloResult);
|
|
return $reponse->getAnnoncesBaloResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function getAnnoncesBoamp($siren, $idAnn=null, $filtre = null, $position=0, $nbRep=20)
|
|
{
|
|
$filename = 'annoncesboamp-'.$siren.'-'.$idAnn.'-'.$position.'-'.$nbRep;
|
|
$cache = new Cache($filename);
|
|
/*if ( $cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}*/
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->idAnn = $idAnn;
|
|
|
|
$params->filtre = null;
|
|
if (!empty($filtre) && in_array($filtre,array('A','M'))) {
|
|
$filtreStruct = new stdClass();
|
|
$filtreStruct->key = 'type';
|
|
$filtreStruct->value = $filtre;
|
|
$params->filtre[] = $filtreStruct;
|
|
}
|
|
|
|
$params->position = $position;
|
|
$params->nbRep = $nbRep;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getAnnoncesBoamp($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getAnnoncesBoampResult);
|
|
return $reponse->getAnnoncesBoampResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function getAnnoncesAsso($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
|
|
{
|
|
$filename = 'annoncesasso-'.$siren.'-'.$idAnn.'-'.$position.'-'.$nbRep;
|
|
$cache = new Cache($filename);
|
|
/*if ( $cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}*/
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->idAnn = $idAnn;
|
|
$params->filtre = $filtre;
|
|
$params->position = $position;
|
|
$params->nbRep = $nbRep;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getAnnoncesAsso($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getAnnoncesAssoResult);
|
|
return $reponse->getAnnoncesAssoResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function getAnnoncesLegales($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
|
|
{
|
|
$filename = 'annonceslegales-'.$siren.'-'.$idAnn.'-'.$position.'-'.$nbRep;
|
|
$cache = new Cache($filename);
|
|
/*if ( $cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}*/
|
|
$params = new stdClass();
|
|
$params->siren = $siren;
|
|
$params->idAnn = $idAnn;
|
|
$params->filtre = $filtre;
|
|
$params->position = $position;
|
|
$params->nbRep = $nbRep;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getAnnoncesLegales($params);
|
|
Zend_Registry::get('firebug')->info($reponse);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getAnnoncesLegalesResult);
|
|
return $reponse->getAnnoncesLegalesResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
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();
|
|
}
|
|
$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($reponse->getAnnoncesResult);
|
|
return $reponse->getAnnoncesResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
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) {
|
|
$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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getSurveillances
|
|
* @param object $filtre
|
|
* @param integer $deb
|
|
* @param integer $nbRep
|
|
* @param string $tri
|
|
*/
|
|
public function getSurveillances($filtre, $deb=0, $nbRep=100)
|
|
{
|
|
$params = new StdClass;
|
|
$params->filtre = $filtre;
|
|
$params->position = $deb;
|
|
$params->nbRep = $nbRep;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getSurveillances($params);
|
|
return $reponse->getSurveillancesResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
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();
|
|
}
|
|
$params = new StdClass;
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getListeBilans($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getListeBilansResult);
|
|
return $reponse->getListeBilansResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
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();
|
|
}
|
|
$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($reponse->getBilanResult);
|
|
return $reponse->getBilanResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
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();
|
|
}
|
|
$params = new StdClass;
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getBanques($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getBanquesResult);
|
|
return $reponse->getBanquesResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
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();
|
|
}
|
|
$params = new StdClass;
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getInfosBourse($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getInfosBourseResult);
|
|
return $reponse->getInfosBourseResult;
|
|
} catch (SoapFault $fault) {
|
|
if ($fault->faultcode=='1030'){
|
|
return $fault->faultstring;
|
|
} else {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getRatios
|
|
* @param string $siren
|
|
* @param string $page
|
|
*/
|
|
public function getRatios($siren, $page = 'ratios')
|
|
{
|
|
$filename = 'ratios-'.$siren.'-'.$page;
|
|
$cache = new Cache($filename);
|
|
Zend_Registry::get('firebug')->info('getRatios');
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new StdClass();
|
|
$params->siren = $siren;
|
|
$params->page = $page;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getRatios($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getRatiosResult);
|
|
return $reponse->getRatiosResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* getDirigeants
|
|
* @param string $siren
|
|
* @param boolean $histo
|
|
*/
|
|
public function getDirigeants($siren, $histo=false)
|
|
{
|
|
$filename = 'dirigeants-'.$siren.'-'.intval($histo);
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new StdClass();
|
|
$params->siren = $siren;
|
|
$params->histo = $histo;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getDirigeants($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getDirigeantsResult);
|
|
return $reponse->getDirigeantsResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getDirigeantsOp
|
|
* @param string $siren
|
|
*/
|
|
public function getDirigeantsOp($siren)
|
|
{
|
|
$filename = 'dirigeantsop-'.$siren;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new StdClass();
|
|
$params->siren = $siren;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getDirigeantsOp($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getDirigeantsOpResult);
|
|
return $reponse->getDirigeantsOpResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getIdentiteLight
|
|
* @param string $siret
|
|
* @param int $id
|
|
* @return mixed
|
|
*/
|
|
public function getIdentiteLight($siret, $id = 0)
|
|
{
|
|
$filename = 'identitelight-'.$siret.'-'.$id;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new StdClass();
|
|
$params->siret = $siret;
|
|
$params->id = $id;
|
|
$client = $this->loadClient('interne');
|
|
try {
|
|
$reponse = $client->getIdentiteLight($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getIdentiteLightResult);
|
|
return $reponse->getIdentiteLightResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
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();
|
|
}
|
|
$params = new StdClass();
|
|
$params->siret = $siret;
|
|
$params->id = $id;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getIdentite($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getIdentiteResult);
|
|
return $reponse->getIdentiteResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getIdentiteProcol
|
|
* @param string $siret
|
|
* @param int $id
|
|
* @return mixed
|
|
*/
|
|
public function getIdentiteProcol($siret, $id = 0)
|
|
{
|
|
$filename = 'identiteprocol-'.$siret.'-'.$id;
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache){
|
|
return $cache->getBlock();
|
|
}
|
|
$params = new StdClass();
|
|
$params->siret = $siret;
|
|
$params->id = $id;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getIdentiteProcol($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getIdentiteProcolResult);
|
|
return $reponse->getIdentiteProcolResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
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();
|
|
}
|
|
$params = new StdClass();
|
|
$params->siren = $siren;
|
|
$params->actifsUniquement = true;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->getLiens($params);
|
|
$cache->deletefile();
|
|
$cache->setBlock($reponse->getLiensResult);
|
|
return $reponse->getLiensResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
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();
|
|
}
|
|
$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($reponse->getListeEvenementsResult);
|
|
return $reponse->getListeEvenementsResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* getListeEtablissements
|
|
* @param string $siren
|
|
* @return mixed
|
|
*/
|
|
public function getListeEtablissements($siren, $actif = -1)
|
|
{
|
|
$filename = 'listeetablissements-'.$siren;
|
|
if ($actif != -1){
|
|
$filename.= '-'.$actif;
|
|
}
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
return $cache->getBlock();
|
|
}
|
|
$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($reponse->getListeEtablissementsResult);
|
|
return $reponse->getListeEtablissementsResult;
|
|
} catch (SoapFault $fault) {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* searchEntreprise
|
|
* @param array $criteres
|
|
* @param int $position
|
|
* @param int $nbRep
|
|
* @param int $actif
|
|
*/
|
|
public function searchEntreprise($criteres, $position = 0, $nbRep = null)
|
|
{
|
|
$params = new StdClass;
|
|
$params->criteres = new StdClass;
|
|
$params->criteres->identifiant = $criteres['identifiant'];
|
|
$params->criteres->raisonSociale = $criteres['raisonSociale'];
|
|
$params->criteres->adresse = $criteres['adresse'];
|
|
$params->criteres->codePostal = $criteres['codePostal'];
|
|
$params->criteres->ville = $criteres['ville'];
|
|
$params->criteres->telFax = $criteres['telFax'];
|
|
$params->criteres->naf = $criteres['naf'];
|
|
$params->criteres->siege = false;
|
|
$params->criteres->actif = in_array($criteres['actif'], array(0,1,2)) ? $criteres['actif'] : 2;
|
|
$params->position = $position;
|
|
$params->nbRep = empty($nbRep) ? $this->nbReponses : $nbRep ;
|
|
$client = $this->loadClient('entreprise');
|
|
try {
|
|
$reponse = $client->searchEntreprise($params);
|
|
return $reponse->searchEntrepriseResult;
|
|
} catch (SoapFault $fault) {
|
|
if (in_array($fault->faultcode, array('1010', '1020'))){
|
|
return $fault->faultstring;
|
|
} else {
|
|
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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) {
|
|
$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;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getListePrefs
|
|
*/
|
|
public function getListePrefs()
|
|
{
|
|
$filename = 'prefs';
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getListeDroits
|
|
*/
|
|
public function getListeDroits()
|
|
{
|
|
$filename = 'droits';
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* getCategory
|
|
*/
|
|
public function getCategory()
|
|
{
|
|
$filename = 'category';
|
|
$cache = new Cache($filename);
|
|
if ($cache->exist() && !$this->toNotCache ){
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* soaperror
|
|
* @param string $method
|
|
* @param soapfault $fault
|
|
* @param string $requete
|
|
* @param string $reponse
|
|
*/
|
|
protected function soaperror($method, $fault, $requete, $reponse)
|
|
{
|
|
$message = '';
|
|
$message.= 'Erreur SOAP - Code : '.$fault->faultcode.' - Message : '.$fault->faultstring;
|
|
$message.= ' - Utilisateur : '.$this->login;
|
|
$message.= "\n\n";
|
|
|
|
$message.= "Method : ".$method.", File :".$fault->getFile().", Ligne : ".$fault->getLine();
|
|
$message.= "\n\n";
|
|
|
|
$message.= "Detail :\n".$fault->getTraceAsString();
|
|
$message.= "\n\n";
|
|
|
|
$controller = Zend_Controller_Front::getInstance();
|
|
$message.= "Request Parameters :\n ".print_r($controller->getRequest()->getParams(), true);
|
|
$message.= "\n\n";
|
|
|
|
$message.= "Referer : ".$_SERVER['HTTP_REFERER']."\n\n";
|
|
|
|
$message.= "Requete :\n ".$requete."\n";
|
|
$message.= "Reponse :\n ".$reponse."\n";
|
|
$configuration = Zend_Registry::get('configuration');
|
|
require_once 'Scores/Mail.php';
|
|
$mail = new Mail();
|
|
$mail->setSubject('[ERREUR SOAP] - '.$configuration->server->name.' -'.date('Ymd'));
|
|
$mail->setBodyTexte($message);
|
|
$mail->setFrom('supportdev');
|
|
$mail->addToKey('supportdev');
|
|
$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['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE;
|
|
$options['login'] = $this->login;
|
|
$options['password'] = $this->password;
|
|
if (APPLICATION_ENV == 'development'){
|
|
$options['cache_wsdl'] = WSDL_CACHE_NONE;
|
|
}
|
|
$options['trace'] = true;
|
|
$options['encoding'] = 'utf-8';
|
|
$client = false;
|
|
try {
|
|
$client = new SoapClient($wsdl, $options);
|
|
} catch (Exception $e) {
|
|
Zend_Registry::get('firebug')->info($e->getMessage());
|
|
throw new Exception('Application Error');
|
|
}
|
|
return $client;
|
|
}
|
|
} |