Ajout méthode getInfosReg, issue #0000379
This commit is contained in:
parent
9b21590f5b
commit
99819369dc
@ -31,3 +31,5 @@ Type.29 = "TvaReturn"
|
||||
Type.30 = "TvaResult"
|
||||
Type.31 = "TribunauxReturn"
|
||||
Type.32 = "TribunalNom"
|
||||
Type.33 = "InfosRegReturn"
|
||||
Type.34 = "InfosReg"
|
34
library/WsScore/Types/InfosRegTypes.php
Normal file
34
library/WsScore/Types/InfosRegTypes.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
class InfosRegReturn
|
||||
{
|
||||
/** @var ErrorType */
|
||||
public $error;
|
||||
/** @var InfosReg[] */
|
||||
public $result;
|
||||
}
|
||||
|
||||
class InfosReg
|
||||
{
|
||||
/** @var int */
|
||||
public $id;
|
||||
/** @var string */
|
||||
public $source;
|
||||
/** @var string */
|
||||
public $DateParution;
|
||||
/** @var string */
|
||||
public $raisonSociale;
|
||||
/** @var string */
|
||||
public $titre;
|
||||
/** @var string */
|
||||
public $communique;
|
||||
/** @var string */
|
||||
public $communiqueHtml;
|
||||
/** @var string */
|
||||
public $pj;
|
||||
/** @var string */
|
||||
public $url;
|
||||
/** @var string */
|
||||
public $dateInsertionSD;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ 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';
|
||||
require_once realpath(dirname(__FILE__)).'/InfosRegTypes.php';
|
||||
|
||||
class ErrorType
|
||||
{
|
||||
|
@ -1550,6 +1550,95 @@ class WsEntreprise
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne tout ou patie des informations règlementées sur l'entreprise
|
||||
*
|
||||
* @param int $siren SIREN de l'entreprise
|
||||
* @param mixed $id Id du communiqué
|
||||
* @return InfosRegReturn
|
||||
*/
|
||||
public function getInfosReg( $siren, $id = false )
|
||||
{
|
||||
//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($id)) $id = false;
|
||||
$tabRet = array();
|
||||
$error = new ErrorType();
|
||||
$siren = substr($siren,0,9);
|
||||
|
||||
debugLog('I',"Infos règlementées demandées pour $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
if ($siren*1==0)
|
||||
{
|
||||
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$error->errnum = 102;
|
||||
$error->errmsg = 'Siren inexistant';
|
||||
}
|
||||
else
|
||||
{
|
||||
$iBourse = new MBourse($siren);
|
||||
$anns = $iBourse->getInfosReg($siren, $id);
|
||||
//debugLog('W', print_r($entrep, true), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
if ( empty($anns) )
|
||||
{
|
||||
debugLog('W', "Aucune info règlementée pour le siren $siren", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$error->errnum = 102;
|
||||
$error->errmsg = 'Aucune info réglementé pour le siren';
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($anns as $nb=>$ann)
|
||||
{
|
||||
//debugLog('I', "Siren/Siret $siren trouvé : ".$etab['Siren'].' '.$etab['Nic'].', '.$etab['Nom'] .', '.$etab['CP'].', '.$etab['Ville'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
if ($id == false)
|
||||
{
|
||||
$infos = new InfosReg();
|
||||
$infos->id = $ann['id'];
|
||||
$infos->source = $ann['source'];
|
||||
$infos->DateParution = $ann['DateParution'];
|
||||
$infos->raisonSociale = $ann['raisonSociale'];
|
||||
$infos->titre = $ann['titre'];
|
||||
$infos->pj = $ann['pj'];
|
||||
$infos->url = $ann['url'];
|
||||
$infos->dateInsertionSD = $ann['dateInsertionSD'];
|
||||
|
||||
$tabRet[] = $infos;
|
||||
}
|
||||
else
|
||||
{
|
||||
$infos = new InfosReg();
|
||||
$infos->id = $ann['id'];
|
||||
$infos->source = $ann['source'];
|
||||
$infos->DateParution = $ann['DateParution'];
|
||||
$infos->raisonSociale = $ann['raisonSociale'];
|
||||
$infos->titre = $ann['titre'];
|
||||
$infos->communique = $ann['communique'];
|
||||
$infos->communiqueHtml = $ann['communiqueHtml'];
|
||||
$infos->pj = $ann['pj'];
|
||||
$infos->url = $ann['url'];
|
||||
$infos->dateInsertionSD = $ann['dateInsertionSD'];
|
||||
|
||||
$tabRet[] = $infos;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
debugLog('I', 'Nb infos retournés = '. count($anns), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
wsLog('infosreg',$siren,$id);
|
||||
}
|
||||
|
||||
$output = new InfosRegReturn();
|
||||
$output->error = $error;
|
||||
$output->result = $tabRet;
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le statut du webservice
|
||||
* @return StatusReturn
|
||||
|
Loading…
x
Reference in New Issue
Block a user