Ajout méthode getTribunaux, issue #0000379

This commit is contained in:
Michael RICOIS 2010-11-15 15:40:01 +00:00
parent 6ee1d8646a
commit 8ea9f682fd
4 changed files with 67 additions and 1 deletions

View File

@ -28,4 +28,6 @@ Type.26 = "InseeReturn"
Type.27 = "InseeResult"
Type.28 = "InseeEven"
Type.29 = "TvaReturn"
Type.30 = "TvaResult"
Type.30 = "TvaResult"
Type.31 = "TribunauxReturn"
Type.32 = "TribunalNom"

View File

@ -0,0 +1,14 @@
<?php
class TribunauxReturn
{
/** @var ErrorType */
public $error;
/** @var TribunalNom[] */
public $result;
}
class TribunalNom
{
/** @var string */
public $nom;
}

View File

@ -8,6 +8,7 @@ require_once realpath(dirname(__FILE__)).'/AnnoncesTypes.php';
require_once realpath(dirname(__FILE__)).'/LiensTypes.php';
require_once realpath(dirname(__FILE__)).'/InseeTypes.php';
require_once realpath(dirname(__FILE__)).'/TvaTypes.php';
require_once realpath(dirname(__FILE__)).'/TribunauxTypes.php';
class ErrorType
{

View File

@ -1500,6 +1500,55 @@ class WsEntreprise
return $output;
}
/**
* Retourne la liste des tribunaux ou Compétences demandées
* @param array|string $tabTypes Tableau des types de Compétences demandés 'C':Commerce, 'I':Instance, 'G':TGI, 'A':Préfectures, 'B':Sous-préf, 'D':Tribunal Administratif, 'H':Prud'hommes, 'L': Cour d'Appel, 'M': Tribunal Mixte, 'O':CCI, 'V': Cour Administrative d'Appel
* @return TribunauxReturn
**/
public function getTribunaux($tabTypes)
{
//Authentification
if (!$this->checkAuth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $_SERVER['REMOTE_ADDR']))
{
throw new SoapFault('900','Identifiant ou mot de passe incorrect !');
exit;
}
//Initialisation
if (empty($tabTypes)) $tabTypes = array();
if (is_string($tabTypes)) $tabTypes = (array)$tabTypes;
$error = new ErrorType();
$iBodacc = new MBodacc();
debugLog('I',"Liste des tribunaux demandées",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
$tabTmp = $iBodacc->getListeTribunaux();
$tabRet = array();
if (count($tabTypes)==0)
{
foreach ($tabTmp as $i=>$tribunal)
{
$tri = new TribunalNom();
$tri->nom = $tribunal['nom'];
$tabRet[$i] = $tri;
}
}
else
{
foreach ($tabTmp as $i=>$tribunal)
{
$type = substr($i,-1);
if (in_array($type, $tabTypes))
{
$tri = new TribunalNom();
$tri->nom = $tribunal['nom'];
$tabRet[$i] = $tri;
}
}
}
$output = new TribunauxReturn();
$output->error = $error;
$output->result = $tabRet;
return $output;
}
/**
* Retourne le statut du webservice