extranet/includes/scoresws/scoresws-int.php
2011-01-07 13:23:05 +00:00

532 lines
16 KiB
PHP

<?php
require_once 'cache/cache.php';
require_once realpath(dirname(__FILE__)).'/functions.php';
global $ws_soap_client_int;
$ws_soap_client_int =
new SoapClient('http://webservice.sd.lan/sinterne?wsdl',
array('login' => 'sbeaugrand',
'password' => 'seb2010',
'cache_wsdl' => WSDL_CACHE_NONE,
'soap_version' => SOAP_1_2,
'trace' => true,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
// -------------------------------------------------------------------------- //
// scoresws_getInfosLogin
// -------------------------------------------------------------------------- //
function scoresws_getInfosLogin($login, $ipUtilisateur = '')
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->login = $login;
if ($ipUtilisateur != '') {
$o->ipUtilisateur = $ipUtilisateur;
}
$O = $ws_soap_client_int->__call('getInfosLogin', array($o));
return $O->getInfosLoginResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_setInfosLogin
// -------------------------------------------------------------------------- //
function scoresws_setInfosLogin($login, $tabInfo)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->login = $login;
$o->tabInfoUserWS = $tabInfo;
$O = $ws_soap_client_int->__call('setInfosLogin', array($o));
return $O->setInfosLoginResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_getNextLogin
// -------------------------------------------------------------------------- //
function scoresws_getNextLogin($login)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->login = $login;
$O = $ws_soap_client_int->__call('getNextLogin', array($o));
return $O->getNextLoginResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_setLog
// -------------------------------------------------------------------------- //
function scoresws_setLog($page, $siret, $id = 0, $ref = '')
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->page = $page;
$o->siret = $siret;
if ($id != 0) {
$o->id = $id;
}
if ($ref != '') {
$o->ref = $ref;
}
$O = $ws_soap_client_int->__call('setLog', array($o));
return $O->setLogResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_getSurveillances
// -------------------------------------------------------------------------- //
function scoresws_getSurveillances($siret = 0, $source = 'annonces',
$detail = false, $deb = 0, $nbRet = 100,
$tri = 'siren')
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->siret = $siret;
$o->source = $source;
$o->detail = $detail;
$o->deb = $deb;
$o->nbRet = $nbRet;
$o->tri = $tri;
$O = $ws_soap_client_int->__call('getSurveillances', array($o));
return $O->getSurveillancesResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_getKbis
// -------------------------------------------------------------------------- //
function scoresws_getKbis($siren)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->siren = $siren;
$O = $ws_soap_client_int->__call('getKbis', array($o));
$kbis = $O->getKbisResult->result;
$return = $kbis['Url'];
if (in_array(ENVIRONNEMENT, array('DEV', 'REC'))) {
$return = str_replace(
'http://tville.scores-decisions.com/ws/data/kbis/',
'http://tville.scores-decisions.com:8088/data/kbis/', $return);
}
return $return;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_commandeAsso
// -------------------------------------------------------------------------- //
function scoresws_commandeAsso($siren, &$infoAsso, &$infoDemande)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->siren = $siren;
$o->infoAsso = $infoAsso;
$o->infoDemande = $infoDemande;
$O = $ws_soap_client_int->__call('commandeAsso', array($o));
return $O->commandeAssoResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_commandeEnquete
// -------------------------------------------------------------------------- //
function scoresws_commandeEnquete($siren, &$infoEnq, &$infoDemande)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->siren = $siren;
$o->infoEnq = $infoEnq;
$o->infoDemande = $infoDemande;
$O = $ws_soap_client_int->__call('commandeEnquete', array($o));
return $O->commandeEnqueteResult;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_getAnnonceCollecte
// -------------------------------------------------------------------------- //
function scoresws_getAnnonceCollecte($idan, $siret = '')
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->idan = $idan;
if ($siret != '') {
$o->siret = $siret;
}
$O = $ws_soap_client_int->__call('getAnnonceCollecte', array($o));
return $O->getAnnonceCollecteResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($client, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_supprAnnonceCollecte
// -------------------------------------------------------------------------- //
function scoresws_supprAnnonceCollecte($idan, $siret = '')
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->idan = $idan;
if ($siret != '') {
$o->siret = $siret;
}
$O = $ws_soap_client_int->__call('supprAnnonceCollecte', array($o));
$error = $O->supprAnnonceCollecteResult->error;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($client, $f, $_SESSION['tabInfo']);
}
if (isset($error) && $error->errNum == 0) {
$output = 'Annonce '.$idan.' supprimé !';
} else if (isset($error) && $error->errNum != 0) {
$output = 'Erreur lors de la suppression.';
} else {
$output = "Une erreur est survenue...";
}
return $output;
}
// -------------------------------------------------------------------------- //
// scoresws_dupliqueAnnonceCollecte
// -------------------------------------------------------------------------- //
function scoresws_dupliqueAnnonceCollecte($idan, $siret)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->idan = $idan;
if ($siret != '') {
$o->siret = $siret;
}
$O = $ws_soap_client_int->__call('dupliqueAnnonceCollecte', array($o));
$error = $O->dupliqueAnnonceCollecteResult->error;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($client, $f, $_SESSION['tabInfo']);
}
if (isset($error) && $error->errNum == 0) {
$output = 'Annonce '.$idan.' dupliqué sur '.$siret.'!';
} elseif (isset($error) && $error->errNum != 0) {
$output = 'Erreur lors de la duplication.';
} else {
$output = "Une erreur est survenue...";
}
return $output;
}
// -------------------------------------------------------------------------- //
// scoresws_setInfosEntrep
// -------------------------------------------------------------------------- //
function scoresws_setInfosEntrep($siret, $idEntreprise, $tabInfos)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->siret = $siret;
$o->idEntreprise = $idEntreprise;
$o->tabInfos = $tabInfos;
$O = $ws_soap_client_int->__call('setInfosEntrep', array($o));
return $O->setInfosEntrepResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_getIdCoursAppel
// -------------------------------------------------------------------------- //
function scoresws_getIdCoursAppel($tribunal)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->tribunal = $tribunal;
$O = $ws_soap_client_int->__call('getIdCoursAppel', array($o));
return $O->getIdCoursAppelResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_getListeClients
// -------------------------------------------------------------------------- //
function scoresws_getListeClients($idClient = 0)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->idClient = $idClient;
$O = $ws_soap_client_int->__call('getListeClients', array($o));
return $O->getListeClientsResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_getListeFichierSurv
// -------------------------------------------------------------------------- //
function scoresws_getListeFichierSurv($login, $ref, $nomFic)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->login = $login;
$o->ref = $ref;
$o->nomFic = $nomFic;
$O = $ws_soap_client_int->__call('getListeFichierSurv', array($o));
return $O->getListeFichierSurvResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_rechercheHisto
// -------------------------------------------------------------------------- //
function scoresws_rechercheHisto($recherche, $annee, $typeBod, $deb,
$nbRep, $maxRep = 200, $pertinence = false)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->recherche = $recherche;
$o->annee = $annee;
$o->typeBod = $typeBod;
$o->deb = $deb;
$o->nbRep = $nbRep;
$o->maxRep = $maxRep;
$o->pertinence = $pertinence;
$O = $ws_soap_client_int->__call('rechercheHisto', array($o));
return $O->rechercheHistoResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_getStatsUtilisateurs
// -------------------------------------------------------------------------- //
function scoresws_getStatsUtilisateurs($login, $mois,
$type = 'jour', $payants = false)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->login = $login;
$o->mois = $mois;
$o->type = $type;
$o->payants = $payants;
$O = $ws_soap_client_int->__call('getStatsUtilisateurs', array($o));
return $O->getStatsUtilisateursResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
return false;
}
}
// -------------------------------------------------------------------------- //
// scoresws_getListeUtilisateurs
// -------------------------------------------------------------------------- //
function scoresws_getListeUtilisateurs($login, $idClient = -1)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->login = $login;
$o->idClient = $idClient;
$O = $ws_soap_client_int->__call('getListeUtilisateurs', array($o));
return $O->getListeUtilisateursResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
die();
}
}
// -------------------------------------------------------------------------- //
// scoresws_getListeSurveillancesCsv
// -------------------------------------------------------------------------- //
function scoresws_getListeSurveillancesCsv($source = '',
$login = '', $idClient = 0)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->source = $source;
$o->login = $login;
$o->idClient = $idClient;
$O = $ws_soap_client_int->__call('getListeSurveillancesCsv', array($o));
return $O->getListeSurveillancesCsvResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
exit;
}
}
// -------------------------------------------------------------------------- //
// scoresws_getLogsClients
// -------------------------------------------------------------------------- //
function scoresws_getLogsClients($mois, $detail = 0, $idClient = 0,
$login = '', $all = 0)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->mois = $mois;
$o->detail = $detail;
$o->idClient = $idClient;
$o->login = $login;
$o->all = $all;
$O = $ws_soap_client_int->__call('getLogsClients', array($o));
return $O->getLogsClientsResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
exit;
}
}
// -------------------------------------------------------------------------- //
// scoresws_getPortefeuilleCsv
// -------------------------------------------------------------------------- //
function scoresws_getPortefeuilleCsv($login, $idClient = 0)
{
global $ws_soap_client_int;
try {
$o = new StdClass;
$o->login = $login;
$o->idClient = $idClient;
$O = $ws_soap_client_int->__call('getPortefeuilleCsv', array($o));
return $O->getPortefeuilleCsvResult->result;
} catch (SoapFault $f) {
require_once 'soaperror.php';
processSoapFault($ws_soap_client_int, $f, $_SESSION['tabInfo']);
exit;
}
}