catch pour loadClient, suppr des tabulations
This commit is contained in:
parent
2edc216c92
commit
f983461724
@ -5,10 +5,10 @@ class WsScores
|
||||
protected $login = '';
|
||||
protected $password = '';
|
||||
|
||||
public function __construct($login = '', $password = ''){
|
||||
public function __construct($login = '', $password = '') {
|
||||
$config = parse_ini_file(PATH_SITE.'/config/scoresws.ini', true);
|
||||
$this->webservices = $config[ENVIRONNEMENT];
|
||||
if ( !empty($login) && !empty($password) ){
|
||||
if (empty($login) == false && empty($password) == false) {
|
||||
$this->login = $login;
|
||||
$this->password = $password;
|
||||
} else {
|
||||
@ -17,16 +17,16 @@ class WsScores
|
||||
}
|
||||
}
|
||||
|
||||
public function rechercheEntreprise($type, $criteres, $position=0){
|
||||
public function rechercheEntreprise($type, $criteres, $position = 0) {
|
||||
$params = new stdClass();
|
||||
$params->type = $type;
|
||||
$params->criteres = $criteres;
|
||||
$params->position = $position;
|
||||
if (isset($_SESSION['tabInfo']['nbReponses'])){
|
||||
if (isset($_SESSION['tabInfo']['nbReponses'])) {
|
||||
$params->nbRep = $_SESSION['tabInfo']['nbReponses'];
|
||||
}
|
||||
|
||||
if ($type=='ent'){
|
||||
if ($type == 'ent') {
|
||||
$criteresEntreprise = new stdClass();
|
||||
$criteresEntreprise->identifiant = $criteres['identifiant'];
|
||||
$criteresEntreprise->raisonSociale = $criteres['raisonSociale'];
|
||||
@ -44,7 +44,7 @@ class WsScores
|
||||
$criteresDirigeant->dateNaiss = '';
|
||||
$criteresDirigeant->lieuNaiss = '';
|
||||
|
||||
} elseif ($type=='dir'){
|
||||
} else if ($type == 'dir') {
|
||||
$criteresEntreprise = new stdClass();
|
||||
$criteresEntreprise->identifiant = '';
|
||||
$criteresEntreprise->raisonSociale = '';
|
||||
@ -62,8 +62,8 @@ class WsScores
|
||||
$criteresDirigeant->dateNaiss = $criteres['dateNaiss'];
|
||||
$criteresDirigeant->lieuNaiss = $criteres['lieuNaiss'];
|
||||
}
|
||||
try {
|
||||
$client = $this->loadClient('entreprise');
|
||||
try {
|
||||
$reponse = $client->rechercheEntreprise($params);
|
||||
FB::log($reponse, 'rechercheEntreprise');
|
||||
return $reponse->rechercheEntrepriseResult;
|
||||
@ -74,13 +74,14 @@ class WsScores
|
||||
}
|
||||
}
|
||||
|
||||
public function getPortefeuille($filtre, $position = 0, $nbAffichage = 100){
|
||||
public function getPortefeuille($filtre,
|
||||
$position = 0, $nbAffichage = 100) {
|
||||
$params = new stdClass();
|
||||
$params->filtre = $filtre;
|
||||
$params->deb = $position;
|
||||
$params->nbRep = $nbAffichage;
|
||||
try {
|
||||
$client = $this->loadClient('interne');
|
||||
try {
|
||||
$reponse = $client->getPortefeuille($params);
|
||||
return $reponse->getPortefeuilleResult;
|
||||
} catch (SoapFault $fault) {
|
||||
@ -90,9 +91,9 @@ class WsScores
|
||||
}
|
||||
}
|
||||
|
||||
public function getListeDroits(){
|
||||
try {
|
||||
public function getListeDroits() {
|
||||
$client = $this->loadClient('interne');
|
||||
try {
|
||||
$reponse = $client->getListeDroits();
|
||||
return $reponse->getListeDroitsResult;
|
||||
} catch (SoapFault $fault) {
|
||||
@ -102,9 +103,9 @@ class WsScores
|
||||
}
|
||||
}
|
||||
|
||||
public function getListePrefs(){
|
||||
try {
|
||||
public function getListePrefs() {
|
||||
$client = $this->loadClient('interne');
|
||||
try {
|
||||
$reponse = $client->getListePrefs();
|
||||
return $reponse->getListePrefsResult;
|
||||
} catch (SoapFault $fault) {
|
||||
@ -114,12 +115,12 @@ class WsScores
|
||||
}
|
||||
}
|
||||
|
||||
public function setClient($tabInfos, $idModele = null){
|
||||
public function setClient($tabInfos, $idModele = null) {
|
||||
$params = new stdClass();
|
||||
if (!empty($idModele)){
|
||||
if (empty($idModele) == false) {
|
||||
$params->idModele = $idModele;
|
||||
}
|
||||
//Element du tableau
|
||||
// Element du tableau
|
||||
$client = new stdClass();
|
||||
$client->idClient = $tabInfos['idClient'];
|
||||
$client->nom = $tabInfos['nom'];
|
||||
@ -171,8 +172,8 @@ class WsScores
|
||||
$client->InterSudLogin = $tabInfos['InterSudLogin'];
|
||||
$client->InterSudPass = $tabInfos['InterSudPass'];
|
||||
$params->infos = $client;
|
||||
try {
|
||||
$client = $this->loadClient('interne');
|
||||
try {
|
||||
$reponse = $client->setClient($params);
|
||||
return $reponse->setClientResult;
|
||||
} catch (SoapFault $fault) {
|
||||
@ -182,55 +183,55 @@ class WsScores
|
||||
}
|
||||
}
|
||||
|
||||
public function getListeClients($idClient = 0){
|
||||
public function getListeClients($idClient = 0) {
|
||||
$params = new stdClass();
|
||||
$params->idClient = $idClient;
|
||||
try {
|
||||
$client = $this->loadClient('interne');
|
||||
try {
|
||||
$reponse = $client->getListeClients($params);
|
||||
return $reponse->getListeClientsResult;
|
||||
} catch (SoapFault $fault) {
|
||||
require_once 'soaperror.php';
|
||||
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
||||
processSoapFault($client, $fault, $_SESSION['tabInfo']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getListeUtilisateurs($login, $idClient=-1){
|
||||
public function getListeUtilisateurs($login, $idClient = -1) {
|
||||
$params = new stdClass();
|
||||
$params->login = $login;
|
||||
$params->idClient = $idClient;
|
||||
try {
|
||||
$client = $this->loadClient('interne');
|
||||
try {
|
||||
$reponse = $client->getListeUtilisateurs($params);
|
||||
return $reponse->getListeUtilisateursResult;
|
||||
} catch (SoapFault $fault) {
|
||||
require_once 'soaperror.php';
|
||||
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
||||
processSoapFault($client, $fault, $_SESSION['tabInfo']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function setInfosLogin($login, $tabInfos){
|
||||
public function setInfosLogin($login, $tabInfos) {
|
||||
$params = new stdClass();
|
||||
$params->login = $login;
|
||||
$params->tabInfoUserWS = $tabInfos;
|
||||
try {
|
||||
$client = $this->loadClient('interne');
|
||||
try {
|
||||
$reponse = $client->setInfosLogin($params);
|
||||
return $reponse->seInfosLoginResult->result;
|
||||
} catch (SoapFault $fault) {
|
||||
require_once 'soaperror.php';
|
||||
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
||||
processSoapFault($client, $fault, $_SESSION['tabInfo']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getNextLogin($login = ''){
|
||||
public function getNextLogin($login = '') {
|
||||
$params = new stdClass();
|
||||
$params->login = $login;
|
||||
try {
|
||||
$client = $this->loadClient('interne');
|
||||
try {
|
||||
$reponse = $client->getNextLogin($params);
|
||||
return $reponse->getNextLoginResult;
|
||||
} catch (SoapFault $fault) {
|
||||
@ -240,12 +241,12 @@ class WsScores
|
||||
}
|
||||
}
|
||||
|
||||
public function getInfosLogin($login, $ipUtilisateur = ''){
|
||||
public function getInfosLogin($login, $ipUtilisateur = '') {
|
||||
$params = new stdClass();
|
||||
$params->login = $login;
|
||||
$params->ipUtilisateur = $ipUtilisateur;
|
||||
try {
|
||||
$client = $this->loadClient('interne');
|
||||
try {
|
||||
$reponse = $client->getInfosLogin($params);
|
||||
return $reponse->getInfosLoginResult;
|
||||
} catch (SoapFault $fault) {
|
||||
@ -257,18 +258,31 @@ class WsScores
|
||||
}
|
||||
}
|
||||
|
||||
protected function loadClient($webservice){
|
||||
protected function loadClient($webservice) {
|
||||
$wsdl = $this->webservices['webservices.'.$webservice.'.wsdl'];
|
||||
$options['trace'] = isset($this->webservices['webservices.'.$webservice.'options.trace']) ?
|
||||
$this->webservices['webservices.'.$webservice.'options.trace'] : false;
|
||||
$options['soap_version'] = isset($this->webservices['webservices.'.$webservice.'options.soap_version']) ?
|
||||
$this->webservices['webservices.'.$webservice.'options.soap_version'] : SOAP_1_2;
|
||||
$options['features'] = isset($this->webservices['webservices.'.$webservice.'options.features']) ?
|
||||
$this->webservices['webservices.'.$webservice.'options.features'] : '';
|
||||
$options['trace'] =
|
||||
isset($this->webservices['webservices.'.$webservice.
|
||||
'options.trace']) ?
|
||||
$this->webservices['webservices.'.$webservice.
|
||||
'options.trace'] : false;
|
||||
$options['soap_version'] =
|
||||
isset($this->webservices['webservices.'.$webservice.
|
||||
'options.soap_version']) ?
|
||||
$this->webservices['webservices.'.$webservice.
|
||||
'options.soap_version'] : SOAP_1_2;
|
||||
$options['features'] =
|
||||
isset($this->webservices['webservices.'.$webservice.
|
||||
'options.features']) ?
|
||||
$this->webservices['webservices.'.$webservice.
|
||||
'options.features'] : '';
|
||||
$options['login'] = $this->login;
|
||||
$options['password'] = $this->password;
|
||||
try {
|
||||
$client = new SoapClient($wsdl, $options);
|
||||
} catch (SoapFault $f) {
|
||||
require_once 'soaperror.php';
|
||||
print messageSoapFault();
|
||||
}
|
||||
return $client;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ function scoresws_annonces($siret, $siren, $idEntreprise,
|
||||
} else {
|
||||
$fileName = 'annonces-'.$siren;
|
||||
}
|
||||
if ($vue != '') {
|
||||
if ($vue != '' && $idan != false) {
|
||||
$fileName .= '-'.$idan;
|
||||
}
|
||||
cache_filename($fileName);
|
||||
@ -161,7 +161,7 @@ function scoresws_annonces($siret, $siren, $idEntreprise,
|
||||
$o = new StdClass;
|
||||
$o->siren = $siren;
|
||||
$o->filtre = $filtre;
|
||||
if ($idan !== false) {
|
||||
if ($idan != false) {
|
||||
$o->idAnn = $idan;
|
||||
}
|
||||
//$o->position = ;
|
||||
@ -321,7 +321,7 @@ function scoresws_listeBilans($siret, $siren, $idEntreprise, $mil)
|
||||
} else {
|
||||
$fileName = 'liasse-'.$siret;
|
||||
}
|
||||
if ($mil !== false) {
|
||||
if ($mil != false) {
|
||||
$indice = str_replace('/', '', substr($mil[0], 0, 11));
|
||||
$fileName .= '-'.$indice;
|
||||
}
|
||||
@ -349,7 +349,7 @@ function scoresws_listeBilans($siret, $siren, $idEntreprise, $mil)
|
||||
cache_delete();
|
||||
cache_add('tabBilans', $tabBilans);
|
||||
|
||||
if ($mil !== false) {
|
||||
if ($mil != false) {
|
||||
$o = new StdClass;
|
||||
$o->siren = $siren;
|
||||
$o->millesime = substr($mil[0], -10);
|
||||
@ -391,7 +391,9 @@ function scoresws_indiscore($siret, $siren, $idEntreprise, $niveau = 2)
|
||||
} else {
|
||||
try {
|
||||
$plus = false;
|
||||
if (hasPerm('INDISCOREP') || hasPerm('INDISCORE2P') || hasPerm('INDISCORE3P')){
|
||||
if (hasPerm('INDISCOREP') ||
|
||||
hasPerm('INDISCORE2P') ||
|
||||
hasPerm('INDISCORE3P')) {
|
||||
$plus = true;
|
||||
}
|
||||
$params = new StdClass;
|
||||
@ -403,12 +405,12 @@ function scoresws_indiscore($siret, $siren, $idEntreprise, $niveau = 2)
|
||||
if ($niveau != 2) {
|
||||
$params->niveau = $niveau;
|
||||
}
|
||||
//$params->plus = $plus;
|
||||
$O = $ws_soap_client_ent->getIndiscore($params);
|
||||
$params->plus = $plus;
|
||||
$O = $ws_soap_client_ent->getIndiScore($params);
|
||||
print '<pre>';
|
||||
print_r($O);
|
||||
print '</pre>';
|
||||
$return = $O->getIndiscoreResult->result;
|
||||
$return = $O->getIndiScoreResult->result;
|
||||
cache_delete();
|
||||
cache_add('etab', $return);
|
||||
} catch (SoapFault $f) {
|
||||
@ -845,10 +847,18 @@ function scorews_setSurveillance($siret, $email, $ref = '',
|
||||
$o = new StdClass;
|
||||
$o->siret = $siret;
|
||||
$o->email = $email;
|
||||
if ($ref != '') {
|
||||
$o->ref = $ref;
|
||||
}
|
||||
if ($source != 'annonces') {
|
||||
$o->source = $source;
|
||||
}
|
||||
if ($delete != false) {
|
||||
$o->delete = $delete;
|
||||
}
|
||||
if ($encoursClient != 0) {
|
||||
$o->encoursClient = $encoursClient;
|
||||
}
|
||||
|
||||
$O = $ws_soap_client_ent->__call('setSurveillance', array($o));
|
||||
|
||||
@ -912,8 +922,12 @@ function scorews_searchMandataire($nom, $type = array(), $cpDep = 0)
|
||||
try {
|
||||
$o = new StdClass;
|
||||
$o->nom = $nom;
|
||||
if (empty($type) == false) {
|
||||
$o->type = $type;
|
||||
}
|
||||
if ($cpDep != 0) {
|
||||
$o->cpDep = $cpDep;
|
||||
}
|
||||
|
||||
$O = $ws_soap_client_ent->__call('searchMandataire', array($o));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user