extranet/library/Scores/WsScores.php

3381 lines
100 KiB
PHP
Raw Normal View History

2011-01-06 08:37:20 +00:00
<?php
require_once realpath(dirname(__FILE__)).'/Cache.php';
2011-01-06 08:37:20 +00:00
class WsScores
{
2013-05-23 13:42:00 +00:00
/**
* WebService configuration
* @var array
*/
protected $webservices = array();
/**
* User login
* @var string
*/
2011-01-07 17:16:07 +00:00
protected $login = '';
2013-05-23 13:42:00 +00:00
/**
* User password
* @var string
*/
2011-01-07 17:16:07 +00:00
protected $password = '';
2013-05-23 13:42:00 +00:00
/**
* Standard nbReponse use
* @var int
*/
2011-04-11 14:20:26 +00:00
protected $nbReponses = 20;
2012-05-20 16:31:28 +00:00
2013-05-23 13:42:00 +00:00
/**
* Enable/Disable using of cache
* @var unknown
*/
protected $cacheEnable = true;
/**
* Enbale/Disable cache writing
* @var boolean
*/
protected $cacheWrite = true;
/**
* Load WebService config
* @param string $login
* @param string $password
*/
2011-04-11 14:20:26 +00:00
public function __construct($login = '', $password = '')
{
$c = Zend_Registry::get('config');
$location = $c->profil->webservice->location;
2013-01-15 17:14:31 +00:00
2012-11-16 09:31:47 +00:00
$cWS = new Zend_Config_Ini(realpath(dirname(__FILE__)) . '/webservices.ini');
$config = $cWS->toArray();
2012-07-30 09:35:19 +00:00
if (APPLICATION_ENV == 'staging' && array_key_exists($location.'-staging', $config)) {
$location.= '-staging';
}
$this->webservices = $config[$location]['webservices'];
2011-01-07 17:16:07 +00:00
if ( !empty($login) && !empty($password) ){
$this->login = $login;
$this->password = $password;
} else {
2012-05-20 16:31:28 +00:00
$user = new Scores_Utilisateur();
$this->login = $user->getLogin();
2011-09-07 12:54:43 +00:00
$this->password = $user->getPassword();
$this->nbReponses = $user->getNbRep();
if ( $user->checkModeEdition() ) {
2013-05-23 13:42:00 +00:00
//Don't use the cache
$this->cacheEnable = false;
//Don't write cache
if ( APPLICATION_ENV == 'staging' ) {
$this->cacheWrite = false;
}
}
2011-01-07 17:16:07 +00:00
}
2011-01-06 08:37:20 +00:00
}
2013-01-15 17:14:31 +00:00
2013-05-23 13:42:00 +00:00
/**
* 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'){
2013-11-29 13:54:52 +00:00
$options['cache_wsdl'] = WSDL_CACHE_NONE;
2013-05-23 13:42:00 +00:00
}
$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;
}
2014-03-14 10:42:09 +00:00
public function getEntrepriseLiasseInfos($siren)
{
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getLiasseInfos($params);
return $reponse->getLiasseInfosResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setSaisieContactEt($siret, $type, $value, $info, $id = null, $delete = false)
2013-12-26 14:42:44 +00:00
{
$params = new stdClass();
$params->id = $id;
$params->siret = $siret;
$params->type = $type;
$params->value = $value;
$params->info = $info;
$params->delete = $delete;
2013-12-26 14:42:44 +00:00
$client = $this->loadClient('saisie');
try {
$reponse = $client->setContactEt($params);
return $reponse->setContactEtResult;
2013-12-26 14:42:44 +00:00
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
public function getSaisieContactEt($id)
{
$params = new stdClass();
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getContactEt($params);
return $reponse->getContactEtResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
public function getContactEt($siret, $filter = null)
{
$filename = 'getcontactet-'.$siret;
if ( $filter !== null ) {
$filename.= '-'.$filter;
}
2013-11-21 16:31:49 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new stdClass();
$params->siret = $siret;
2013-12-26 14:42:44 +00:00
$params->filtre = $filter;
2013-11-21 16:31:49 +00:00
$client = $this->loadClient('interne');
try {
$reponse = $client->getContactEt($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getContactEtResult);
}
return $reponse->getContactEtResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
*
* @param unknown $siren
* @param number $offset
* @param number $nbItems
* @return boolean
*/
2013-11-13 14:10:30 +00:00
public function getSubventionList($siren, $offset = 0, $nbItems = 100)
{
$params = new stdClass();
$params->companyId = $siren;
$params->offset = $offset;
$params->nbItems = $nbItems;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getSubventionList($params);
return $reponse->getSubventionListResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* Subvention Detail
* @param int $id
* @return boolean
*/
public function getSubventionDetail($id)
{
$params = new stdClass();
$params->id = $id;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getSubventionDetail($params);
return $reponse->getSubventionDetailResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
*
* @param unknown $siren
* @param number $nic
* @param number $niveau
* @return Ambigous <boolean, mixed>|boolean
*/
public function getEntrepriseValo($siren, $nic=0, $niveau=2)
{
$filename = 'getvalo-'.$siren.'-'.$nic.'-'.$niveau;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2013-05-23 13:42:00 +00:00
$params = new stdClass();
$params->siren = $siren;
$params->nic = $nic;
$params->niveau = $niveau;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getValo($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getValoResult);
}
return $reponse->getValoResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function setSurveillancesMail($login, $email)
{
$params = new stdClass();
$params->login = $login;
$params->email = $email;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setSurveillancesMail($params);
return $reponse->setSurveillancesMailResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setUserService($login, $code)
{
$params = new stdClass();
$params->login = $login;
$params->code = $code;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setUserService($params);
return $reponse->setUserServiceResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getCatalogEvent($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns = $columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getEvent($params);
return $reponse->getEventResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2013-03-12 09:02:47 +00:00
public function getCatalogNaf5($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns =$columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getNaf5($params);
return $reponse->getNaf5Result;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2013-03-20 14:09:48 +00:00
2013-03-20 06:19:46 +00:00
public function getCatalogFctDir($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns =$columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getDirFonction($params);
return $reponse->getDirFonctionResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2013-11-21 16:31:49 +00:00
public function getCatalogCity($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns = $columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getCity($params);
return $reponse->getCityResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getCatalogLegalForm($id, $columns)
{
$params = new stdClass();
$params->id = $id;
$params->columns =$columns;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getLegalForm($params);
return $reponse->getLegalFormResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setLienChange($action, $idLien, $id)
{
$params = new stdClass();
$params->action = $action;
$params->idLien = $idLien;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setLienChange($params);
return $reponse->setLienChangeResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2013-01-15 17:14:31 +00:00
/**
2013-06-06 12:01:45 +00:00
* Set Score Cut Off
2013-01-15 17:14:31 +00:00
* @param string $siren
* @param int $encours
* @param int $scoreSolv
* @param int $scoreDir
* @param int $scoreConf
* @param string $remarque
2013-08-12 12:08:03 +00:00
* @param boolean delete
2013-01-15 17:14:31 +00:00
* @return boolean
*/
2013-08-12 12:08:03 +00:00
public function setScoreCutoff($siren, $encours, $scoreSolv, $scoreDir, $scoreConf, $remarque, $delete)
2013-01-15 17:14:31 +00:00
{
$infos = array(
'siren' => $siren,
'encours' => $encours,
'scoreSolv' => $scoreSolv,
'scoreDir' => $scoreDir,
'scoreConf' => $scoreConf,
'remarque' => $remarque,
);
$params = new stdClass();
$params->infos = json_encode($infos);
2013-08-12 12:08:03 +00:00
$params->delete = $delete;
2013-03-20 14:09:48 +00:00
$client = $this->loadClient('saisie');
2013-01-15 17:14:31 +00:00
try {
$reponse = $client->setScoreCutoff($params);
return $reponse->setScoreCutoffResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
2013-03-20 14:31:36 +00:00
return $fault->faultstring;
2013-01-15 17:14:31 +00:00
}
}
2013-09-23 08:47:30 +00:00
2013-06-06 12:01:45 +00:00
/**
* Get Score Cut Off
* @param string $siren
* @return Cutoff values or False
*/
public function getScoreCutoff($siren)
{
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getScoreCutoff($params);
return $reponse->getScoreCutoffResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
2013-09-23 08:47:30 +00:00
2013-07-30 08:42:29 +00:00
/**
* Delete Score Cut Off
* @param string $siren
* @return boolean
*/
public function delScoreCutoff($siren)
{
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('saisie');
try {
$reponse = $client->delScoreCutoff($params); //change name when webservice is ready
return $reponse->delScoreCutoffResult; //change name when webservice is ready
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
2013-01-15 17:14:31 +00:00
public function searchLogin($idClient, $query)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->query = $query;
$client = $this->loadClient('gestion');
try {
$reponse = $client->searchLogin($params);
return $reponse->searchLoginResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-12-12 21:19:42 +00:00
public function getCatalogCurrency()
{
$filename = 'catalog-currency';
$cache = new Cache($filename);
if ( $cache->exist() ){
return $cache->getBlock();
}
2013-01-15 17:14:31 +00:00
2012-12-12 21:19:42 +00:00
$params = new stdClass();
$params->id = null;
$client = $this->loadClient('catalog');
try {
$reponse = $client->getCurrency($params);
$cache->deletefile();
$cache->setBlock($reponse->getCurrencyResult);
return $reponse->getCurrencyResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function getCatalogCountry()
{
$filename = 'catalog-country';
$cache = new Cache($filename);
if ( $cache->exist() ){
return $cache->getBlock();
}
2013-01-15 17:14:31 +00:00
$params = new stdClass();
$params->id = null;
$params->columns = array(
'codPays3',
'libPays',
'devise',
'indTel',
);
$client = $this->loadClient('catalog');
try {
$reponse = $client->getCountry($params);
$cache->deletefile();
$cache->setBlock($reponse->getCountryResult);
return $reponse->getCountryResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2013-01-15 17:14:31 +00:00
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;
}
}
}
2013-01-15 17:14:31 +00:00
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;
}
}
2013-01-15 17:14:31 +00:00
}
2013-01-15 17:14:31 +00:00
public function setClientTarif($idClient, $log, $service, $type, $priceUnit, $limit, $date, $duree, $doublon)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->tarif->log = $log;
$params->tarif->service = $service;
$params->tarif->type = $type;
$params->tarif->priceUnit = $priceUnit;
$params->tarif->limit = $limit;
$params->tarif->date = $date;
$params->tarif->duree = $duree;
$params->tarif->doublon = $doublon;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setClientTarif($params);
return $reponse->setClientTarifResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2013-01-15 17:14:31 +00:00
public function getClientTarifs($idClient, $service = null)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->service = $service;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getClientTarifs($params);
return $reponse->getClientTarifsResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2013-01-15 17:14:31 +00:00
public function setService($idClient, $infos)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->infos = $infos;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setService($params);
return $reponse->setServiceResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function getServiceUsers($idClient, $service)
{
$params = new stdClass();
$params->idClient = $idClient;
$params->serviceCode = $service;
$client = $this->loadClient('gestion');
try {
2013-01-15 17:14:31 +00:00
$reponse = $client->getServiceUsers($params);
Zend_Registry::get('firebug')->info($reponse);
2013-01-15 17:14:31 +00:00
return $reponse->getServiceUsersResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2013-01-15 17:14:31 +00:00
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;
}
}
}
2013-01-15 17:14:31 +00:00
2012-10-16 13:54:14 +00:00
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;
}
}
}
2013-01-15 17:14:31 +00:00
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;
}
}
2012-10-16 13:54:14 +00:00
}
2013-01-15 17:14:31 +00:00
2012-11-22 07:44:55 +00:00
public function getLienDoc($id, $type = null, $groupe = false)
2012-11-09 16:24:11 +00:00
{
$params = new stdClass();
$params->id = $id;
$params->type = $type;
$params->groupe = $groupes;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getLienDoc($params);
return $reponse->getLienDocResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2013-01-15 17:14:31 +00:00
2012-11-07 17:21:39 +00:00
public function setLienDoc($infos, $id = null)
{
$params = new stdClass();
$params->infos = $infos;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setLienDoc($params);
return $reponse->setLienDocResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2013-01-15 17:14:31 +00:00
2012-10-15 09:12:59 +00:00
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;
}
}
}
2013-01-15 17:14:31 +00:00
public function getSaisieLienRef($id)
{
$params = new stdClass();
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getLienRef($params);
return $reponse->getLienRefResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2013-01-15 17:14:31 +00:00
2012-10-24 07:57:39 +00:00
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;
}
}
}
2013-01-15 17:14:31 +00:00
2012-10-15 09:12:59 +00:00
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;
}
}
}
2013-01-15 17:14:31 +00:00
2012-11-22 07:44:55 +00:00
public function searchLienRef($query, $type = null)
2012-10-15 09:12:59 +00:00
{
$params = new stdClass();
$params->query = $query;
2012-11-22 07:44:55 +00:00
$params->type = $type;
2012-10-15 09:12:59 +00:00
$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;
}
}
}
2013-01-15 17:14:31 +00:00
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;
}
}
}
2013-01-15 17:14:31 +00:00
2012-09-21 19:40:45 +00:00
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;
2012-09-21 19:40:45 +00:00
$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;
}
}
}
2013-01-15 17:14:31 +00:00
/**
* Liste des bilans
2014-02-13 14:41:39 +00:00
* @param string $identifiant
* Siren
* @param int $position
* @param int $nbRep
*
*/
2014-02-13 14:41:39 +00:00
public function getPiecesBilans($identifiant, $position = 0, $nbRep = 200)
{
2014-02-13 14:41:39 +00:00
$params = new stdClass();
$params->identifiant = $identifiant;
$params->position = $position;
$params->nbRep = $nbRep;
$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;
}
}
2013-01-15 17:14:31 +00:00
/**
* Bilan URL
* @param string $siren
2014-02-13 14:41:39 +00:00
* @param string $type
* @param string $diffusion
* @param string $dateCloture
* @param string $reference
*/
2014-02-13 14:41:39 +00:00
public function getPiecesBilan($siren, $type, $diffusion, $dateCloture, $reference = '')
{
$params = new stdClass();
2013-11-05 14:45:25 +00:00
$params->identifiant = $siren;
$params->dateCloture = $dateCloture;
2014-02-13 14:41:39 +00:00
$params->type = $type;
2013-11-05 14:45:25 +00:00
$params->diffusion = $diffusion;
$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;
}
}
2013-01-15 17:14:31 +00:00
2014-02-13 14:41:39 +00:00
public function getPiecesActe($siren, $diffusion, $depotNum, $depotDate, $acteType, $acteNum, $acteDate, $reference = '')
{
$params = new stdClass();
$params->identifiant = $siren;
$params->diffusion = $diffusion;
$params->depotNum = $depotNum;
$params->depotDate = $depotDate;
$params->acteType = $acteType;
$params->acteNum = $acteNum;
$params->acteDate = $acteDate;
$params->reference = $reference;
$client = $this->loadClient('pieces');
try {
$reponse = $client->getActe($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->getActeResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
public function getPiecesActes($identifiant, $position = 0, $nbRep = 200)
{
$params = new stdClass();
$params->identifiant = $identifiant;
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->loadClient('pieces');
try {
$reponse = $client->getActes($params);
return $reponse->getActesResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2014-05-24 09:22:50 +00:00
public function setPiecesActeCmdEmail($id, $email)
{
$params = new stdClass();
$params->id = $id;
$params->email = $email;
$client = $this->loadClient('pieces');
try {
$reponse = $client->setActeCmdEmail($params);
return $reponse->getActesResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setPiecesBilanCmdEmail($id, $email)
{
$params = new stdClass();
$params->id = $id;
$params->email = $email;
$client = $this->loadClient('pieces');
try {
$reponse = $client->setBilanCmdEmail($params);
return $reponse->getActesResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
public function setPiecesKbisCmdEmail($id, $email)
{
$params = new stdClass();
$params->id = $id;
$params->email = $email;
$client = $this->loadClient('pieces');
try {
$reponse = $client->setKbisCmdEmail($params);
return $reponse->getActesResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2014-02-13 14:41:39 +00:00
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;
}
}
2013-01-15 17:14:31 +00:00
/**
* 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;
}
}
/**
* Get secondary email
* @param string $login
* @param int $id
* @return boolean
*/
public function getGestionEmail($login, $id=null)
{
$params = new stdClass();
$params->login = $login;
$params->id = $id;
$client = $this->loadClient('gestion');
try {
$reponse = $client->getEmail($params);
Zend_Registry::get('firebug')->info($reponse);
return $reponse->getEmailResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Set secondary email
* @param string $email
* @param login $login
* @param int $id
* @param string $action
* @return boolean
*/
public function setGestionEmail($email, $login, $id=null, $action = 'set')
{
$params = new stdClass();
$params->email = $email;
$params->login = $login;
$params->id = $id;
$params->action = $action;
$client = $this->loadClient('gestion');
try {
$reponse = $client->setEmail($params);
return $reponse->setEmailResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Retourne les infos du groupe
* @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;
2012-05-20 16:31:28 +00:00
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('Error')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2012-05-20 16:31:28 +00:00
/**
* Retourne l'arborescence d'un groupe
* @param string $siren
2012-12-03 15:02:44 +00:00
* @param int pctMin
* @param int $nbNiveaux
*/
public function getGroupesArbo($siren, $pctMin=33, $nbNiveaux=10, $stopAtIsin = false)
{
$filename = 'groupesarbo-'.$siren.'-'.$pctMin;
$filename.= '-0';
if ($stopAtIsin === true) {
$filename.= '-1';
}
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2012-05-20 16:31:28 +00:00
}
2013-05-23 13:42:00 +00:00
$params = new StdClass;
$params->siren = $siren;
$params->pctMin = $pctMin;
$params->stopAtIsin = $stopAtIsin;
$params->nbNiveaux = $nbNiveaux;
$client = $this->loadClient('interne');
try {
$reponse = $client->getGroupesArbo($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getGroupesArboResult);
}
return $reponse->getGroupesArboResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
2012-05-20 16:31:28 +00:00
}
}
2012-05-20 16:31:28 +00:00
/**
* Récupération des kbis
*/
public function getKbis($siren, $diffusion, $reference='')
{
$params = new StdClass;
$params->siren = $siren;
$params->diffusion = $diffusion;
$params->reference = $reference;
$client = $this->loadClient('pieces');
try {
$reponse = $client->getKbis($params);
2012-03-09 16:00:42 +00:00
return $reponse->getKbisResult;
} catch (SoapFault $fault) {
2012-07-30 09:35:19 +00:00
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;
}
}
2012-05-20 16:31:28 +00:00
}
/**
* 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;
}
}
2012-05-20 16:31:28 +00:00
2011-12-09 15:27:22 +00:00
/**
* 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;
2012-05-20 16:31:28 +00:00
$params->position = $position;
2011-12-09 15:27:22 +00:00
$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;
2012-05-20 16:31:28 +00:00
}
2011-12-09 15:27:22 +00:00
}
2012-05-20 16:31:28 +00:00
2011-12-05 13:03:55 +00:00
/**
* Enter description here ...
* @param unknown_type $siren
* @return Ambigous <boolean, mixed>|boolean
*/
public function getListeDepots($siren)
{
$filename = 'listedepots-'.$siren;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2011-12-05 13:03:55 +00:00
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('interne');
try {
$reponse = $client->getListeDepots($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getListeDepotsResult);
}
2011-12-05 13:03:55 +00:00
return $reponse->getListeDepotsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-09-06 12:08:21 +00:00
/**
* 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;
}
}
2012-05-20 16:31:28 +00:00
2011-12-05 13:03:55 +00:00
/**
* Enter description here ...
* @param string $siret
* @param integer $id
* @param array $infos
2011-12-05 13:03:55 +00:00
* @return boolean
*/
public function setInfosEntrep($siret, $id, $infos)
2011-07-06 15:31:24 +00:00
{
$params = new stdClass();
$params->siret = $siret;
$params->idEntreprise = $siret;
$params->infos = json_encode($infos);
$client = $this->loadClient('saisie');
2011-07-06 15:31:24 +00:00
try {
$reponse = $client->setInfosEntrep($params);
return $reponse->setInfosEntrepResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-07-06 15:31:24 +00:00
return false;
2012-05-20 16:31:28 +00:00
}
2011-07-06 15:31:24 +00:00
}
2012-05-20 16:31:28 +00:00
2011-07-06 15:31:24 +00:00
/**
* Enter description here ...
* @param unknown_type $idAnn
* @param unknown_type $siret
*/
2011-07-01 12:44:12 +00:00
public function supprAnnonceCollecte($idAnn, $siret = '')
{
$params = new stdClass();
$params->idAnn= $idAnn;
$params->siret= $siret;
$client = $this->loadClient('saisie');
2011-07-01 12:44:12 +00:00
try {
$reponse = $client->supprAnnonceCollecte($params);
return $reponse->supprAnnonceCollecteResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-07-01 12:44:12 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
/**
* 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;
}
}
2012-05-20 16:31:28 +00:00
/**
* 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;
}
}
2012-05-20 16:31:28 +00:00
/**
* 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;
}
}
2012-05-20 16:31:28 +00:00
2011-05-24 09:12:40 +00:00
/**
* getRapport
* @param string $siren
* @param integer $niveau
* @param integer $id
* @param boolean $plus
* @param string $ref
* @param integer $encours
* @param string $email
2011-05-24 09:12:40 +00:00
*/
public function getRapport($siren, $niveau=3, $id=0, $plus=false, $ref='', $encours=0, $email='')
2011-05-24 09:12:40 +00:00
{
$filename = 'getrapport-'.$siren.'-'.$niveau.'-'.$id;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-24 09:12:40 +00:00
}
2013-05-23 13:42:00 +00:00
2011-05-24 09:12:40 +00:00
$params = new stdClass();
$params->siren = $siren;
$params->niveau = $niveau;
$params->id = $id;
$params->plus = $plus;
$params->ref = $ref;
$params->encours = $encours;
$params->email = $email;
2011-05-24 09:12:40 +00:00
$client = $this->loadClient('entreprise');
try {
ini_set('default_socket_timeout', 600);
set_time_limit(300);
$reponse = $client->getRapport($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getRapportResult);
}
2011-05-24 09:12:40 +00:00
return $reponse->getRapportResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-05-24 09:12:40 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
/**
* getPortefeuilleCsv
* @param unknown_type $login
* @param unknown_type $idClient
*/
public function getPortefeuilleCsv($login='', $idClient=0)
{
$params = new stdClass();
$params->login = $login;
$params->idClient = $idClient;
2013-01-15 17:14:31 +00:00
2012-08-02 16:19:47 +00:00
//@todo : Seulement pour aider Altysis
$c = Zend_Registry::get('config');
$location = $c->profil->webservice->location;
2013-01-15 17:14:31 +00:00
2012-12-03 07:27:06 +00:00
$cWS = new Zend_Config_Ini(realpath(dirname(__FILE__)) . '/webservices.ini');
$config = $cWS->toArray();
2012-08-02 16:19:47 +00:00
$this->webservices = $config[$location]['webservices'];
//@todo
2013-01-15 17:14:31 +00:00
$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;
}
}
2012-05-20 16:31:28 +00:00
/**
* 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;
}
}
2012-05-20 16:31:28 +00:00
2011-05-20 14:38:31 +00:00
/**
* 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;
2011-10-17 07:15:09 +00:00
$client = $this->loadClient('gestion');
2011-05-20 14:38:31 +00:00
try {
$reponse = $client->getLogsClients($params);
return $reponse->getLogsClientsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-05-20 14:38:31 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-05-19 14:21:08 +00:00
/**
* getIndiScore
* @param string $siren
* @param string $nic
* @param integer $niveau
* @param boolean $plus
* @param string $ref
* @param integer $encours
* @param string $email
2011-05-19 14:21:08 +00:00
*/
public function getIndiScore($siren, $nic=0, $niveau=2, $plus=false, $ref='', $encours=0, $email='')
2011-05-19 14:21:08 +00:00
{
$filename = 'getindiscore-'.$siren.'-'.$nic.'-'.$niveau;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-19 14:21:08 +00:00
}
2013-05-23 13:42:00 +00:00
2011-05-24 09:45:49 +00:00
$params = new stdClass();
$params->siren = $siren;
$params->nic = $nic;
$params->niveau = $niveau;
$params->plus = $plus;
$params->ref = $ref;
$params->encours = $encours;
$params->email = $email;
2011-05-19 14:21:08 +00:00
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getIndiScore($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getIndiScoreResult);
}
2011-05-19 14:21:08 +00:00
return $reponse->getIndiScoreResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
2011-05-19 14:21:08 +00:00
}
}
2012-05-20 16:31:28 +00:00
2011-05-19 06:32:08 +00:00
/**
* setLog
* @param string $page
* @param string $siret
* @param string $id
* @param string $ref
*/
public function setLog ($page, $siret, $id=0, $ref = '')
{
$params = new stdClass();
2012-01-24 14:40:53 +00:00
$params->page = $page;
2011-05-19 06:32:08 +00:00
$params->siret = $siret;
2011-06-30 07:29:54 +00:00
$params->id = $id;
2011-05-19 06:32:08 +00:00
$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());
2011-05-19 06:32:08 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-05-10 09:53:39 +00:00
/**
* getListeClients
* @param unknown_type $idClient
*/
public function getListeClients($idClient=false)
2011-05-10 09:53:39 +00:00
{
$params = new stdClass();
$params->idClient = $idClient;
2011-10-17 07:15:09 +00:00
$client = $this->loadClient('gestion');
2011-05-10 09:53:39 +00:00
try {
$reponse = $client->getListeClients($params);
return $reponse->getListeClientsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-05-10 09:53:39 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:15:20 +00:00
/**
* 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'];
2011-05-09 10:15:20 +00:00
$client = $this->loadClient('interne');
try {
$reponse = $client->setMandataire($params);
return $reponse->setMandataireResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-05-09 10:15:20 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* 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());
2011-05-09 10:06:06 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* searchMandataires
* @param unknown_type $nom
* @param unknown_type $type
* @param unknown_type $cpDep
*/
2011-05-09 09:43:38 +00:00
public function searchMandataires($nom, $type=array(), $cpDep=0)
{
$params = new stdClass();
$params->nom = $nom;
$params->type = $type;
$params->cpDep = $cpDep;
$client = $this->loadClient('interne');
2011-05-09 09:43:38 +00:00
try {
$reponse = $client->searchMandataires($params);
return $reponse->searchMandatairesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-05-09 09:43:38 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-07-01 06:57:17 +00:00
/**
* getMandataire
* @param string $idMand
*/
public function getMandataire($idMand)
{
$params = new stdClass();
2012-12-04 14:21:08 +00:00
$params->id = $idMand;
$client = $this->loadClient('saisie');
2011-07-01 06:57:17 +00:00
try {
$reponse = $client->getMandataire($params);
return $reponse->getMandataireResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-07-01 06:57:17 +00:00
return false;
}
}
2011-09-13 20:14:10 +00:00
/**
* 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;
}
}
2012-05-20 16:31:28 +00:00
2011-09-13 20:14:10 +00:00
/**
* 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;
2012-05-20 16:31:28 +00:00
}
2011-09-13 20:14:10 +00:00
}
2012-05-20 16:31:28 +00:00
2011-06-30 14:19:17 +00:00
/**
* Recherche par dirigeants
2011-07-01 07:29:22 +00:00
* @param array $criteres
2011-06-30 14:19:17 +00:00
* @param integer $deb
* @param integer $nbRep
* @param integer $maxRep
*/
2011-07-01 07:29:22 +00:00
public function searchDir($criteres, $deb=0, $nbRep=20, $maxRep=200)
2011-06-30 14:19:17 +00:00
{
$params = new stdClass();
2011-07-01 07:29:22 +00:00
$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 ;
2011-06-30 14:19:17 +00:00
$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());
2011-06-30 14:19:17 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
/**
* 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
*/
2011-08-19 13:27:44 +00:00
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;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* 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;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* getListeJalCollecte
* Enter description here ...
*/
public function getListeJalCollecte()
{
2011-05-18 09:11:34 +00:00
$filename = 'listejalcollecte';
$cache = new Cache($filename);
2013-05-23 13:42:00 +00:00
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
2011-05-18 09:11:34 +00:00
}
2011-05-24 09:45:49 +00:00
$params = new stdClass();
$client = $this->loadClient('interne');
try {
$reponse = $client->getListeJalCollecte();
2011-05-18 09:11:34 +00:00
$cache->deletefile();
$cache->setBlock($reponse->getListeJalCollecteResult);
return $reponse->getListeJalCollecteResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* 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;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* 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;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* 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;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* 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)
2011-05-04 13:39:06 +00:00
{
$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());
2011-05-04 13:39:06 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* getListeUtilisateurs
* Enter description here ...
* @param string $login
* @param integer $idClient
*/
2011-05-03 15:43:40 +00:00
public function getListeUtilisateurs($login, $idClient = -1)
{
$params = new stdClass();
$params->login = $login;
$params->idClient = $idClient;
2011-10-17 07:15:09 +00:00
$client = $this->loadClient('gestion');
2011-05-03 15:43:40 +00:00
try {
$reponse = $client->getListeUtilisateurs($params);
return $reponse->getListeUtilisateursResult;
2011-05-04 13:39:06 +00:00
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-05-03 15:43:40 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* getMarques
* Enter description here ...
* @param string $siren
* @param integer $idDepot
*/
2011-05-02 13:38:52 +00:00
public function getMarques($siren, $idDepot = 0)
{
2011-05-24 09:45:49 +00:00
$filename = 'marques-'.$siren.'-'.$idDepot;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2011-05-24 09:45:49 +00:00
$params = new stdClass();
$params->siren = $siren;
$params->idDepot = $idDepot;
2011-05-02 13:38:52 +00:00
$client = $this->loadClient('interne');
try {
$reponse = $client->getMarques($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getMarquesResult);
}
2011-05-02 13:38:52 +00:00
return $reponse->getMarquesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-05-02 13:38:52 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* getListeConventions
* Enter description here ...
* @param string $siren
*/
2011-05-02 12:14:05 +00:00
public function getListeConventions($siren)
{
$filename = 'conventions-'.$siren;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-02 12:14:05 +00:00
}
2013-05-23 13:42:00 +00:00
2011-05-24 09:45:49 +00:00
$params = new stdClass();
$params->siren = $siren;
2011-05-02 12:14:05 +00:00
$client = $this->loadClient('interne');
try {
$reponse = $client->getListeConventions($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getListeConventionsResult);
}
2011-05-02 12:14:05 +00:00
return $reponse->getListeConventionsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-05-02 12:14:05 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* getListeCompetences
* Enter description here ...
* @param string $siret
* @param string $type
* @param string $codeInsee
*/
public function getListeCompetences($siret, $type, $codeInsee)
{
$filename = 'competences-'.$siret.'-'.$type.'-'.$codeInsee;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2013-05-23 13:42:00 +00:00
2011-05-24 09:45:49 +00:00
$params = new stdClass();
$params->siret = $siret;
$params->type = $type;
$params->codeInsee = $codeInsee;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getListeCompetences($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getListeCompetencesResult);
}
return $reponse->getListeCompetencesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-05-09 10:06:06 +00:00
/**
* getInfosReg
* @param string $siren
* @param mixed $id
*/
public function getInfosReg($siren, $id = false)
{
2011-05-24 09:45:49 +00:00
$filename = 'infosreg-'.$siren.'-'.$id;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-24 09:45:49 +00:00
}
2013-05-23 13:42:00 +00:00
$params = new stdClass();
$params->siren = $siren;
$params->id = $id;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getInfosReg($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$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;
}
}
2012-06-07 13:45:57 +00:00
}
2012-04-19 12:37:08 +00:00
public function getAnnoncesNum($siren)
{
$filename = 'annoncesnum-'.$siren;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new stdClass();
$params->siren = $siren;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getAnnoncesNum($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getAnnoncesNumResult);
}
return $reponse->getAnnoncesNumResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2013-01-15 17:14:31 +00:00
public function getAnnoncesBalo($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
2012-04-19 12:37:08 +00:00
{
$filename = 'annoncesbalo-'.$siren.'-'.$idAnn.'-'.$position.'-'.$nbRep;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2012-04-19 12:37:08 +00:00
$params = new stdClass();
$params->siren = $siren;
$params->idAnn = $idAnn;
$params->filtre = $filtre;
2012-04-19 12:37:08 +00:00
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getAnnoncesBalo($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getAnnoncesBaloResult);
}
2012-04-19 12:37:08 +00:00
return $reponse->getAnnoncesBaloResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-06-07 13:45:57 +00:00
public function getAnnoncesBoamp($siren, $idAnn=null, $filtre = null, $position=0, $nbRep=20)
2012-04-19 12:37:08 +00:00
{
$filename = 'annoncesboamp-'.$siren.'-'.$idAnn.'-'.$position.'-'.$nbRep;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2012-04-19 12:37:08 +00:00
$params = new stdClass();
$params->siren = $siren;
$params->idAnn = $idAnn;
2013-01-15 17:14:31 +00:00
2012-07-02 19:31:25 +00:00
$params->filtre = null;
if (!empty($filtre) && in_array($filtre,array('A','M'))) {
$filtreStruct = new stdClass();
$filtreStruct->key = 'type';
$filtreStruct->value = $filtre;
$params->filtre[] = $filtreStruct;
}
2013-01-15 17:14:31 +00:00
2012-04-19 12:37:08 +00:00
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getAnnoncesBoamp($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getAnnoncesBoampResult);
}
2012-04-19 12:37:08 +00:00
return $reponse->getAnnoncesBoampResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-06-07 13:45:57 +00:00
public function getAnnoncesAsso($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
2012-04-19 12:37:08 +00:00
{
$filename = 'annoncesasso-'.$siren.'-'.$idAnn.'-'.$position.'-'.$nbRep;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2012-04-19 12:37:08 +00:00
$params = new stdClass();
$params->siren = $siren;
$params->idAnn = $idAnn;
$params->filtre = $filtre;
2012-04-19 12:37:08 +00:00
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getAnnoncesAsso($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getAnnoncesAssoResult);
}
2012-04-19 12:37:08 +00:00
return $reponse->getAnnoncesAssoResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-06-07 13:45:57 +00:00
public function getAnnoncesLegales($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
2012-04-19 12:37:08 +00:00
{
$filename = 'annonceslegales-'.$siren.'-'.$idAnn.'-'.$position.'-'.$nbRep;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2012-04-19 12:37:08 +00:00
$params = new stdClass();
$params->siren = $siren;
$params->idAnn = $idAnn;
$params->filtre = $filtre;
2012-04-19 12:37:08 +00:00
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getAnnoncesLegales($params);
Zend_Registry::get('firebug')->info($reponse);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getAnnoncesLegalesResult);
}
2012-04-19 12:37:08 +00:00
return $reponse->getAnnoncesLegalesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-06-07 13:45:57 +00:00
2011-05-09 10:06:06 +00:00
/**
* 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)
{
2011-05-24 09:45:49 +00:00
$filename = 'annonces-'.$siren.'-'.$filtre.'-'.$idAnn.'-'.$position.'-'.$nbRep;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-24 09:45:49 +00:00
}
2013-05-23 13:42:00 +00:00
$params = new stdClass();
$params->siren = $siren;
$params->filtre = $filtre;
$params->idAnn = $idAnn;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getAnnonces($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getAnnoncesResult);
}
return $reponse->getAnnoncesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-04-21 12:32:08 +00:00
/**
* 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());
2011-04-21 12:32:08 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-04-19 09:07:57 +00:00
/**
* getPortefeuille
* @param object $filtre
* @param integer $position
* @param integer $nbAffichage
*/
public function getPortefeuille($filtre, $position = 0, $nbAffichage = 100)
{
2011-04-19 09:07:57 +00:00
$params = new StdClass;
$params->filtre = $filtre;
$params->deb = $position;
$params->nbRep = $nbAffichage;
$client = $this->loadClient('interne');
try {
$reponse = $client->getPortefeuille($params);
return $reponse->getPortefeuilleResult;
2011-04-21 12:32:08 +00:00
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-04-19 09:07:57 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-04-19 08:51:18 +00:00
/**
* getSurveillances
2012-02-10 15:54:50 +00:00
* @param object $filtre
2011-04-19 08:51:18 +00:00
* @param integer $deb
* @param integer $nbRep
* @param string $tri
*/
2012-02-10 15:54:50 +00:00
public function getSurveillances($filtre, $deb=0, $nbRep=100)
2011-04-19 08:51:18 +00:00
{
$params = new StdClass;
2012-02-10 15:54:50 +00:00
$params->filtre = $filtre;
2011-04-19 08:51:18 +00:00
$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());
2011-04-19 08:51:18 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-04-19 07:44:15 +00:00
/**
* getListeBilans
* @param string $siren
*/
2011-05-24 09:45:49 +00:00
public function getListeBilans($siren)
{
$filename = 'listebilans-'.$siren;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-24 09:45:49 +00:00
}
2013-05-23 13:42:00 +00:00
2011-05-24 09:45:49 +00:00
$params = new StdClass;
2011-04-19 07:44:15 +00:00
$params->siren = $siren;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getListeBilans($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getListeBilansResult);
}
2011-04-19 07:44:15 +00:00
return $reponse->getListeBilansResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-04-19 07:44:15 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-04-19 07:44:15 +00:00
/**
* getBilan
* @param string $siren
* @param unknown_type $millesime
* @param unknown_type $typeBilan
* @param unknown_type $ref
*/
2011-05-24 09:45:49 +00:00
public function getBilan($siren, $millesime, $typeBilan, $ref)
{
2011-05-24 09:57:40 +00:00
$filename = 'bilan-'.$siren.'-'.$millesime.'-'.$typeBilan.'-'.$ref;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2011-05-24 09:45:49 +00:00
$params = new StdClass;
2011-04-19 07:44:15 +00:00
$params->siren = $siren;
$params->millesime = $millesime;
$params->typeBilan = $typeBilan;
$params->ref = $ref;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getBilan($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getBilanResult);
}
2011-04-19 07:44:15 +00:00
return $reponse->getBilanResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-04-19 07:44:15 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-04-19 07:41:24 +00:00
/**
* getBanques
* @param string $siren
*/
2011-05-24 09:45:49 +00:00
public function getBanques($siren)
{
$filename = 'banques-'.$siren;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-24 09:45:49 +00:00
}
2013-05-23 13:42:00 +00:00
2011-05-24 09:45:49 +00:00
$params = new StdClass;
2011-04-19 07:41:24 +00:00
$params->siren = $siren;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getBanques($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getBanquesResult);
}
2011-04-19 07:41:24 +00:00
return $reponse->getBanquesResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-04-19 07:41:24 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-04-19 07:41:24 +00:00
/**
* getInfosBourse
* @param string $siren
*/
2011-05-24 09:45:49 +00:00
public function getInfosBourse($siren)
{
$filename = 'infosbourse-'.$siren;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-24 09:45:49 +00:00
}
2013-05-23 13:42:00 +00:00
2011-05-24 09:45:49 +00:00
$params = new StdClass;
2011-04-19 07:41:24 +00:00
$params->siren = $siren;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getInfosBourse($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getInfosBourseResult);
}
2011-04-19 07:41:24 +00:00
return $reponse->getInfosBourseResult;
} catch (SoapFault $fault) {
if ($fault->faultcode=='1030'){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
2011-04-19 07:41:24 +00:00
}
}
2012-05-20 16:31:28 +00:00
2011-04-19 07:14:04 +00:00
/**
* getRatios
* @param string $siren
* @param string $page
*/
public function getRatios($siren, $page = 'ratios')
{
2011-05-24 09:45:49 +00:00
$filename = 'ratios-'.$siren.'-'.$page;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-24 09:45:49 +00:00
}
2013-05-23 13:42:00 +00:00
2011-04-19 07:14:04 +00:00
$params = new StdClass();
$params->siren = $siren;
$params->page = $page;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getRatios($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getRatiosResult);
}
2011-04-19 07:14:04 +00:00
return $reponse->getRatiosResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-04-19 07:14:04 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-04-19 06:23:20 +00:00
/**
* getDirigeants
* @param string $siren
* @param boolean $histo
*/
public function getDirigeants($siren, $histo=false)
{
$filename = 'dirigeants-'.$siren.'-'.intval($histo);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2013-05-23 13:42:00 +00:00
2011-05-24 09:45:49 +00:00
$params = new StdClass();
$params->siren = $siren;
$params->histo = $histo;
2011-04-19 06:23:20 +00:00
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getDirigeants($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getDirigeantsResult);
}
2011-04-19 06:23:20 +00:00
return $reponse->getDirigeantsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-04-19 06:23:20 +00:00
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-12-05 13:03:55 +00:00
/**
* getDirigeantsOp
* @param string $siren
*/
public function getDirigeantsOp($siren, $id = null)
2011-12-05 13:03:55 +00:00
{
$filename = 'dirigeantsop-'.$siren.'-'.intval($id);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-12-05 13:03:55 +00:00
}
2013-05-23 13:42:00 +00:00
2011-12-05 13:03:55 +00:00
$params = new StdClass();
$params->siren = $siren;
$params->id = $id;
2011-12-05 13:03:55 +00:00
$client = $this->loadClient('interne');
try {
$reponse = $client->getDirigeantsOp($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getDirigeantsOpResult);
}
2011-12-05 13:03:55 +00:00
return $reponse->getDirigeantsOpResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-05-20 16:31:28 +00:00
/**
* setDirigeantsOp
* @param array $infos
*/
public function setDirigeantsOp($infos, $mode, $id)
{
$params = new stdClass();
$params->infos = $infos;
$params->mode = $mode;
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setDirigeantsOp($params);
return $reponse->setDirigeantsOpResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2014-06-10 09:19:24 +00:00
/**
* Avis RNCS
* @param string $siren
* @return mixed
*/
public function getEntrepriseAvisRncs($siren)
{
$filename = 'avisrncs-'.$siren;
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new StdClass();
$params->siren = $siren;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getAvisRncs($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getAvisRncsResult);
}
return $reponse->getAvisRncsResult;
} 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;
}
}
}
2012-02-08 19:34:58 +00:00
/**
* getIdentiteLight
* @param string $siret
* @param int $id
* @return mixed
*/
public function getIdentiteLight($siret, $id = 0)
{
$filename = 'identitelight-'.$siret.'-'.$id;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2012-02-08 19:34:58 +00:00
}
2013-05-23 13:42:00 +00:00
2012-02-08 19:34:58 +00:00
$params = new StdClass();
$params->siret = $siret;
$params->id = $id;
$client = $this->loadClient('interne');
try {
$reponse = $client->getIdentiteLight($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getIdentiteLightResult);
}
2012-02-08 19:34:58 +00:00
return $reponse->getIdentiteLightResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-04-14 13:12:50 +00:00
/**
* getIdentite
* @param string $siret
* @param int $id
* @return mixed
*/
public function getIdentite($siret, $id = 0)
{
$filename = 'identite-'.$siret.'-'.$id;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2013-05-23 13:42:00 +00:00
2011-05-24 09:45:49 +00:00
$params = new StdClass();
$params->siret = $siret;
$params->id = $id;
$client = $this->loadClient('entreprise');
2011-04-14 13:12:50 +00:00
try {
$reponse = $client->getIdentite($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getIdentiteResult);
}
2011-04-14 13:12:50 +00:00
return $reponse->getIdentiteResult;
} catch (SoapFault $fault) {
if (in_array($fault->getCode(), '1020')) {
return $fault->getMessage();
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
2011-04-14 13:12:50 +00:00
}
}
2012-05-20 16:31:28 +00:00
2011-06-14 08:45:19 +00:00
/**
* getIdentiteProcol
* @param string $siret
* @param int $id
* @return mixed
*/
public function getIdentiteProcol($siret, $id = 0)
{
$filename = 'identiteprocol-'.$siret.'-'.$id;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-06-14 08:45:19 +00:00
}
2013-05-23 13:42:00 +00:00
2011-06-14 08:45:19 +00:00
$params = new StdClass();
$params->siret = $siret;
$params->id = $id;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getIdentiteProcol($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getIdentiteProcolResult);
}
2011-06-14 08:45:19 +00:00
return $reponse->getIdentiteProcolResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-06-14 08:45:19 +00:00
throw new Zend_Soap_Client_Exception($fault);
return false;
}
}
2012-05-20 16:31:28 +00:00
/**
* getLiensById
* @param int $id
* @return mixed
*/
public function getLiensById($id)
{
$filename = 'liensbyid-'.$id;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
2013-05-23 13:42:00 +00:00
$params = new StdClass();
$params->id = $id;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getLiensById($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getLiensByIdResult);
}
2012-11-15 15:41:35 +00:00
return $reponse->getLiensByIdResult;
} catch (SoapFault $fault) {
if ($fault->getCode()=='MSG') {
return $fault->getMessage();
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2012-05-20 16:31:28 +00:00
/**
* getLiens
* @param string $siren
* @return mixed
*/
public function getLiens($siren)
{
2011-05-24 09:45:49 +00:00
$filename = 'liens-'.$siren;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-24 09:45:49 +00:00
}
2013-05-23 13:42:00 +00:00
$params = new StdClass();
$params->siren = $siren;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getLiens($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getLiensResult);
}
return $reponse->getLiensResult;
} catch (SoapFault $fault) {
if ($fault->getCode()=='MSG') {
return $fault->getMessage();
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
2012-05-20 16:31:28 +00:00
/**
* 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)
{
2011-05-24 09:45:49 +00:00
$filename = 'listeevenements-'.$siren.'-'.$nic.'-'.$position.'-'.$nbRep;
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-24 09:45:49 +00:00
}
2013-05-23 13:42:00 +00:00
2011-05-24 09:45:49 +00:00
$params = new stdClass();
$params->siren = $siren;
$params->nic = $nic;
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getListeEvenements($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getListeEvenementsResult);
}
return $reponse->getListeEvenementsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
2012-05-20 16:31:28 +00:00
}
2012-05-20 16:31:28 +00:00
/**
* getListeEtablissements
* @param string $siren
* @return mixed
*/
public function getListeEtablissements($siren, $actif = -1, $position = 0, $nbRep=20)
{
$filename = 'listeetablissements-'.$siren.'-'.$position;
if ($actif != -1){
$filename.= '-'.$actif;
}
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
2011-05-24 09:45:49 +00:00
}
2013-05-23 13:42:00 +00:00
2011-05-24 09:45:49 +00:00
$params = new StdClass();
$params->siren = $siren;
$params->dep = 0;
2011-04-22 13:30:35 +00:00
$params->actif = $actif;
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getListeEtablissements($params);
2013-05-23 13:42:00 +00:00
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getListeEtablissementsResult);
}
return $reponse->getListeEtablissementsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-05-20 16:31:28 +00:00
/**
* Liste des établissements avec coordonnées GPS
* @param string $siren
* @param unknown $actif
* @param number $position
* @param number $nbRep
* @return Ambigous <boolean, mixed>|boolean
*/
public function getEtablissementsGeo($siren, $actif = -1, $position = 0, $nbRep=20)
{
$filename = 'etablissementsgeo-'.$siren.'-'.$position;
if ($actif != -1){
$filename.= '-'.$actif;
}
if ($this->cacheWrite) {
$cache = new Cache($filename);
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock();
}
}
$params = new StdClass();
$params->siren = $siren;
$params->dep = 0;
$params->actif = $actif;
$params->position = $position;
$params->nbRep = $nbRep;
$client = $this->loadClient('interne');
try {
$reponse = $client->getEtablissementsGeo($params);
if ($this->cacheWrite) {
$cache->deletefile();
$cache->setBlock($reponse->getEtablissementsGeoResult);
}
return $reponse->getEtablissementsGeoResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* Encodate GPS d'une adresse d'établissement
* @param string $siret
* @param string $lat
* @param string $lon
* @param string $alt
* @param string $precis
* @param string $returnadresse
* @return boolean
*/
public function setEtablissementGeoCode($siret, $lat, $lon, $alt, $precis, $returnadresse)
{
$params = new StdClass();
$params->siret = $siret;
$params->latitude = $lat;
$params->longitude = $lon;
$params->altitude = $alt;
$params->precis = $precis;
$params->returnadresse = $returnadresse;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setEtablissementsGeoCode($params);
return $reponse->setEtablissementsGeoCodeResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2011-04-11 14:20:26 +00:00
/**
* searchEntreprise
2012-04-25 15:33:09 +00:00
* @param array $criteres
* @param int $position
* @param int $nbRep
* @param int $actif
2011-04-11 14:20:26 +00:00
*/
public function searchEntreprise($criteres, $position = 0, $nbRep = null)
2011-04-11 14:20:26 +00:00
{
$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;
2012-04-25 15:33:09 +00:00
$params->criteres->actif = in_array($criteres['actif'], array(0,1,2)) ? $criteres['actif'] : 2;
$params->criteres->fj = $criteres['fj'];
2011-04-11 14:20:26 +00:00
$params->position = $position;
$params->nbRep = empty($nbRep) ? $this->nbReponses : $nbRep ;
2011-04-11 14:20:26 +00:00
$client = $this->loadClient('entreprise');
try {
$reponse = $client->searchEntreprise($params);
return $reponse->searchEntrepriseResult;
2011-04-11 14:20:26 +00:00
} catch (SoapFault $fault) {
2011-09-06 06:48:54 +00:00
if (in_array($fault->faultcode, array('1010', '1020'))){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
2011-04-11 14:20:26 +00:00
}
}
2012-05-20 16:31:28 +00:00
/**
* setCmdAsso
* @param unknown_type $infosCommande
* @param unknown_type $infosDemandeur
* @return boolean
*/
2011-06-29 16:07:23 +00:00
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());
2011-06-29 16:07:23 +00:00
Zend_Registry::get('firebug')->info($fault);
//Placer exception pour affichage message
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-06-29 07:14:04 +00:00
/**
* Enregistre ou modifie un client
* @param unknown_type $infos
* @return boolean
*/
public function setClient($infos)
2011-06-29 07:14:04 +00:00
{
$params = new stdClass();
$params->infos = json_encode($infos);
2011-06-29 07:14:04 +00:00
try {
2011-10-17 07:15:09 +00:00
$client = $this->loadClient('gestion');
2011-06-29 07:14:04 +00:00
$reponse = $client->setClient($params);
return $reponse->setClientResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-06-29 07:14:04 +00:00
Zend_Registry::get('firebug')->info($fault);
//Placer exception pour affichage message
return false;
}
}
2011-04-11 14:20:26 +00:00
2011-05-03 12:56:06 +00:00
/**
* setInfosLogin
* @param string $login
* @param string $action
2012-07-16 13:25:23 +00:00
* @param array $infos
2011-05-03 12:56:06 +00:00
*/
public function setInfosLogin($login, $action, $infos = null)
{
$params = new stdClass();
$params->login = $login;
$params->action = $action;
2012-07-16 13:25:23 +00:00
if ($infos !== null ) {
$params->infos = json_encode($infos);
}
2011-05-03 12:56:06 +00:00
try {
2011-10-17 07:15:09 +00:00
$client = $this->loadClient('gestion');
2011-05-03 12:56:06 +00:00
$reponse = $client->setInfosLogin($params);
return $reponse->setInfosLoginResult;
} catch (SoapFault $fault) {
if (in_array($fault->getCode(),array('MSG','ERR'))) {
return $fault->getMessage();
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
Zend_Registry::get('firebug')->info($fault);
//Placer exception pour affichage message
return false;
}
2011-05-03 12:56:06 +00:00
}
}
2012-05-20 16:31:28 +00:00
2011-04-11 14:20:26 +00:00
/**
* getInfosLogin
* @param string $login
* @param string $ipUtilisateur
2011-04-11 14:20:26 +00:00
*/
public function getInfosLogin($login, $ipUtilisateur = '')
{
2011-01-06 08:37:20 +00:00
$params = new stdClass();
$params->login = $login;
$params->ipUtilisateur = $ipUtilisateur;
2011-01-07 17:16:07 +00:00
try {
2011-10-17 07:15:09 +00:00
$client = $this->loadClient('gestion');
$reponse = $client->getInfosLogin($params);
2011-01-07 17:16:07 +00:00
return $reponse->getInfosLoginResult;
} catch (SoapFault $fault) {
2012-05-20 16:31:28 +00:00
if (substr($fault->faultcode,0,1)=='0'){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
2011-01-07 17:16:07 +00:00
}
2011-01-06 08:37:20 +00:00
}
/**
* getScoreHistorique pour les derniers 5 ans
* @param string $siret
* @param string $type
*/
public function getScoresHisto($siret, $type = 'indiscore')
{
$params = new stdClass();
$params->siret = $siret;
$params->type = $type;
try {
$client = $this->loadClient('interne');
$reponse = $client->getScoresHisto($params);
return $reponse->getScoresHistoResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-04-11 14:20:26 +00:00
/**
* getNextLogin
* @param int $idClient
2011-04-11 14:20:26 +00:00
*/
public function getNextLogin($idClient)
2011-04-11 14:20:26 +00:00
{
2011-04-01 12:14:40 +00:00
$params = new stdClass();
$params->idClient = $idClient;
2011-04-01 12:14:40 +00:00
try {
2011-10-17 07:15:09 +00:00
$client = $this->loadClient('gestion');
2011-04-01 12:14:40 +00:00
$reponse = $client->getNextLogin($params);
Zend_Registry::get('firebug')->info($reponse);
2011-04-01 12:14:40 +00:00
return $reponse->getNextLoginResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
Zend_Registry::get('firebug')->info($fault);
2011-04-01 12:14:40 +00:00
//Placer exception pour affichage message
return false;
}
}
2012-05-20 16:31:28 +00:00
/**
* getLogs
*/
public function getLogs()
{
$filename = 'logs';
$cache = new Cache($filename);
2013-05-23 13:42:00 +00:00
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock('logs');
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->getLogs();
$cache->deletefile();
$cache->setBlock($reponse->getLogsResult);
return $reponse->getLogsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
//Placer exception pour affichage message
return false;
}
}
2011-04-11 14:20:26 +00:00
/**
* getListePrefs
*/
public function getListePrefs()
{
2011-05-03 15:43:40 +00:00
$filename = 'prefs';
$cache = new Cache($filename);
2013-05-23 13:42:00 +00:00
if ($cache->exist() && $this->cacheEnable ){
2011-05-03 15:43:40 +00:00
return $cache->getBlock('prefs');
}
2011-04-01 12:14:40 +00:00
try {
2011-10-17 07:15:09 +00:00
$client = $this->loadClient('gestion');
2011-04-01 12:14:40 +00:00
$reponse = $client->getListePrefs();
2011-05-03 15:43:40 +00:00
$cache->deletefile();
$cache->setBlock($reponse->getListePrefsResult);
2011-04-01 12:14:40 +00:00
return $reponse->getListePrefsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-04-01 12:14:40 +00:00
//Placer exception pour affichage message
return false;
}
}
2012-05-20 16:31:28 +00:00
2011-04-11 14:20:26 +00:00
/**
* getListeDroits
*/
public function getListeDroits()
{
2011-05-03 15:43:40 +00:00
$filename = 'droits';
$cache = new Cache($filename);
2013-05-23 13:42:00 +00:00
if ($cache->exist() && $this->cacheEnable ){
2011-05-03 15:43:40 +00:00
return $cache->getBlock('droits');
}
2011-04-01 12:14:40 +00:00
try {
2011-10-17 07:15:09 +00:00
$client = $this->loadClient('gestion');
2011-04-01 12:14:40 +00:00
$reponse = $client->getListeDroits();
2011-05-03 15:43:40 +00:00
$cache->deletefile();
$cache->setBlock($reponse->getListeDroitsResult);
2011-04-01 12:14:40 +00:00
return $reponse->getListeDroitsResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
2011-04-01 12:14:40 +00:00
//Placer exception pour affichage message
return false;
}
}
2011-04-11 14:20:26 +00:00
/**
* getCategory
*/
public function getCategory()
{
$filename = 'category';
$cache = new Cache($filename);
2013-05-23 13:42:00 +00:00
if ($cache->exist() && $this->cacheEnable ){
return $cache->getBlock('category');
}
try {
$client = $this->loadClient('gestion');
$reponse = $client->getCategory();
$cache->deletefile();
$cache->setBlock($reponse->getCategoryResult);
return $reponse->getCategoryResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
//Placer exception pour affichage message
return false;
}
2013-01-15 17:14:31 +00:00
}
2013-01-15 17:14:31 +00:00
2011-04-11 14:20:26 +00:00
/**
* soaperror
* @param string $method
* @param soapfault $fault
* @param string $requete
* @param string $reponse
2011-04-11 14:20:26 +00:00
*/
protected function soaperror($method, $fault, $requete, $reponse)
2011-04-11 14:20:26 +00:00
{
2011-04-19 07:14:04 +00:00
$message = '';
$message.= 'Erreur SOAP - Code : '.$fault->faultcode.' - Message : '.$fault->faultstring;
2011-08-12 14:56:57 +00:00
$message.= ' - Utilisateur : '.$this->login;
$message.= "\n\n";
2012-05-20 16:31:28 +00:00
2011-08-12 14:56:57 +00:00
$message.= "Method : ".$method.", File :".$fault->getFile().", Ligne : ".$fault->getLine();
$message.= "\n\n";
2012-05-20 16:31:28 +00:00
2011-08-12 14:56:57 +00:00
$message.= "Detail :\n".$fault->getTraceAsString();
$message.= "\n\n";
2013-10-04 12:41:24 +00:00
if ( $controller = Zend_Controller_Front::getInstance() ) {
$message.= "Request Parameters :\n ".print_r($controller->getRequest()->getParams(), true);
$message.= "\n\n";
}
2012-05-20 16:31:28 +00:00
2012-02-08 09:25:32 +00:00
$message.= "Referer : ".$_SERVER['HTTP_REFERER']."\n\n";
2012-05-20 16:31:28 +00:00
$message.= "Requete :\n ".$requete."\n";
2012-05-20 16:31:28 +00:00
$message.= "Reponse :\n ".$reponse."\n";
if (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'staging') {
$c = Zend_Registry::get('config');
$mail = new Scores_Mail();
$mail->setSubject('[ERREUR SOAP] - '.$c->profil->server->name.' -'.date('Ymd'));
$mail->setBodyTexte($message);
$mail->setFrom('supportdev');
$mail->addToKey('supportdev');
$mail->send();
}
2011-04-11 14:20:26 +00:00
}
2012-07-30 09:35:19 +00:00
}