extranet/library/Scores/Ws/Entreprise.php
2014-03-14 10:42:09 +00:00

952 lines
25 KiB
PHP

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