Ajout méthode getListeConventions, issue #0000379

This commit is contained in:
Michael RICOIS 2010-11-15 16:28:25 +00:00
parent b327ffc515
commit 9b21590f5b
3 changed files with 114 additions and 1 deletions

View File

@ -34,4 +34,7 @@ Type.32 = "ListeCompetencesReturn"
Type.33 = "ListeCompetencesResult"
Type.34 = "Competence"
Type.35 = "BanquesReturn"
Type.36 = "Banque"
Type.36 = "Banque"
Type.37 = "ListeConventionsReturn"
Type.38 = "Convention"
"

View File

@ -558,4 +558,32 @@ class Banque
public $cp;
/** @var string */
public $ville;
}
class ListeConventionsReturn
{
/** @var ErrorType */
public $error;
/** @var Convention[] */
public $result;
}
class Convention
{
/** @var string */
public $idCC;
/** @var string */
public $nomCC;
/** @var string */
public $infoCC;
/** @var string */
public $editorCC;
/** @var int */
public $nbPageCC;
/** @var string */
public $isbnCC;
/** @var string */
public $dateCC;
/** @var string */
public $joCCmaj;
}

View File

@ -1280,4 +1280,86 @@ class WsInterne
$output->result = $tabRet;
return $output;
}
/**
*
* Retourne la liste des conventions
* @param string $siren
* @return ListeConventionsReturn
*/
protected function getListeConventions($siren)
{
//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
$error = new ErrorType();
$tabRet=array();
debugLog('I',"Liste des conventions demandée pour le siren $siren",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
if (strlen($siren)<>9)
{
debugLog('W', "Siren/Siret $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$error->errnum = 102;
$error->errmsg = 'Siren Siret inexistant';
}
elseif ($siren*1==0)
{
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$error->errnum = 102;
$error->errmsg = 'Siren inexistant';
}
else
{
$tabIdentite = $this->iInsee->getIdentiteEntreprise($siren);
if (empty($tabIdentite) && isset($tabIdentite['erreur']) &&
$tabIdentite['erreur']<>'')
{
debugLog('W', "Siren $siren non présent en base", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$error->errnum = 102;
$error->errmsg = 'Siren inexistant';
}
else
{
$naf = $tabIdentite['NafEnt'];
$trancheEffectif = $tabIdentite['EffEnTr'];
$effectif = $tabIdentite['Effectif'];
$fj = $tabIdentite['entreprise']['FJCodeEntrep'];
$isolv = new MSolvabilite($siren, $naf, $trancheEffectif, $effectif, $tabIdentite['CP'], $fj, $tabIdentite['Capital'],
$tabIdentite['CapitalDev'], $tabIdentite['DateCreaEn'], $tabIdentite['DateCreaEt']);//, $tabIdentite['Singularite']);
$noteStructure = $isolv->getSolvabilite();
$naf4 = $isolv->getNaf4($naf);
$tabTmp = $this->iInsee->listeConventions($naf4, $tabIdentite['Dept']);
foreach ($tabTmp as $i=>$conv)
{
$convention = new Convention();
$convention->idCC = $conv['id CC'];
$convention->nomCC = $conv['nom CC'];
$convention->infoCC = $conv['infoCC'];
$convention->editorCC = $conv['editeur CC'];
$convention->nbPageCC = $conv['nb page CC'];
$convention->isbnCC = $conv['isbn CC'];
$convention->dateCC = $conv['date edition CC'];
$convention->joCCmaj = $conv['joCCmaj'];
$tabRet[$i] = $convention;
}
wsLog('conventions',$siren);
}
}
$output = new ListeConventionsReturn();
$output->error = $error;
$output->result = $tabRet;
return $output;
}
}