issue #0001549 : Suppression getAnnonces, modification structure
This commit is contained in:
parent
95498fb8c5
commit
081cbfeb43
@ -30,6 +30,7 @@ Type[] = "Etablissement"
|
||||
Type[] = "Dirigeant"
|
||||
Type[] = "AnnonceFilter"
|
||||
Type[] = "Annonce"
|
||||
Type[] = "AnnonceEntite"
|
||||
Type[] = "AnnonceEvenement"
|
||||
Type[] = "AnnonceNum"
|
||||
Type[] = "InseeEven"
|
||||
|
@ -1281,271 +1281,6 @@ class Entreprise extends WsScore
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne la liste des annonces légales relative à une entreprise
|
||||
*
|
||||
* @todo Revoir cette fonction pour la faire marcher avec les associations
|
||||
*
|
||||
* @param string $siren Siren de l'entreprise
|
||||
* @param integer $filtre 1=BODACC, 2=B.A.L.O, 3=JO Association, 4=Boamp
|
||||
* @param string $idAnn Identifiant de l'annonce
|
||||
* @param integer $position
|
||||
* @param integer $nbRep
|
||||
* @return AnnoncesReturn
|
||||
*/
|
||||
public function getAnnonces($siren, $filtre = 1, $idAnn = '', $position = 0, $nbRep = 100)
|
||||
{
|
||||
$this->authenticate();
|
||||
|
||||
//Initialisation
|
||||
if (empty($filtre)) { $filtre = 1; }
|
||||
if (empty($idAnn)) { $idAnn = ''; }
|
||||
if (empty($position)) { $position = 0; }
|
||||
if (empty($nbRep)) { $nbRep = 100; }
|
||||
|
||||
//Valeur max
|
||||
if($nbRep > 200) { $nbRep = 200; }
|
||||
|
||||
debugLog('I',"Annonces demandées pour $siren ($filtre, $idAnn)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
$liste = array();
|
||||
|
||||
if (strlen($siren)!=9) {
|
||||
debugLog('W', "Siren/Siret $siren incorrect", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->sendError('1010');
|
||||
} elseif (intval($siren)==0 && $idAnn=='') {
|
||||
debugLog('W', "Siren $siren ou annonce $idAnn inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->sendError('1010');
|
||||
}
|
||||
|
||||
$iInsee = new MInsee();
|
||||
/*
|
||||
if ($siren>100 && $filtre==3) $asso=true;
|
||||
else {
|
||||
$asso=false;
|
||||
$tabIdentite=$this->iInsee->getIdentiteLight($siren);
|
||||
if ($tabIdentite['FJ']>90 && $tabIdentite['FJ']<94 ||
|
||||
$tabIdentite['FJ']>9000 && $tabIdentite['FJ']<9400) $asso=true;
|
||||
}*/
|
||||
|
||||
//@todo : Connaitre le nombre d'annonce
|
||||
|
||||
/*
|
||||
getAnnoncesBoamp => Avis de marché, Avis d'attribution
|
||||
getAnnoncesAsso => Rien de particulier
|
||||
getAnnoncesBalo => Rien de particulier
|
||||
getAnnoncesLegales => Plusieurs requetes SQL suivant la situation
|
||||
*/
|
||||
|
||||
if ($idAnn=='') {
|
||||
$anns=$iInsee->getAnnoncesLegales($siren);
|
||||
$annsB=$iInsee->getAnnoncesBalo($siren);
|
||||
$annsA=$iInsee->getAnnoncesAsso($siren);
|
||||
$annsM=$iInsee->getAnnoncesBoamp($siren, $idAnn);
|
||||
} elseif ($filtre==1)
|
||||
$anns=$iInsee->getAnnoncesLegales($siren, $idAnn);
|
||||
elseif ($filtre==2)
|
||||
$annsB=$iInsee->getAnnoncesBalo($siren, $idAnn);
|
||||
elseif ($filtre==3)
|
||||
$annsA=$iInsee->getAnnoncesAsso($siren, $idAnn);
|
||||
elseif ($filtre==4)
|
||||
$annsM=$iInsee->getAnnoncesBoamp($siren, $idAnn);
|
||||
|
||||
//debugLog('W', print_r($entrep, true), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
if (empty($anns) && empty($annsB) && empty($annsA) && empty($annsM))
|
||||
{
|
||||
debugLog('W', "Aucune annonce pour le siren $siren (source=$filtre, id=$idAnn)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$error->errnum = 102;
|
||||
$error->errmsg = 'Siren inexistant B '.$siren.' '.$idAnn;
|
||||
}
|
||||
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__);
|
||||
$evens = array();
|
||||
foreach ($ann['evenements'] as $tabEven)
|
||||
{
|
||||
$even = new AnnonceEvenement();
|
||||
$even->CodeEven = $tabEven['CodeEven'];
|
||||
$even->LibEven = $tabEven['LibEven'];
|
||||
$evens[] = $even;
|
||||
}
|
||||
$annonce = new Annonce();
|
||||
$annonce->id = $ann['id'];
|
||||
$annonce->BodaccCode = $ann['BodaccCode'];
|
||||
$annonce->BodaccNum = $ann['BodaccNum'];
|
||||
$annonce->NumAnnonce = $ann['NumAnnonce'];
|
||||
$annonce->DateParution = $ann['DateParution']; //@todo : date
|
||||
$annonce->Departement = $ann['Departement'];
|
||||
$annonce->Tribunal = $ann['Tribunal'];
|
||||
$annonce->TribunalCode = $ann['TribunalCode'];
|
||||
$annonce->TribunalSiret = $ann['TribunalSiret'];
|
||||
$annonce->Rubrique = $ann['Rubrique'];
|
||||
$annonce->typeAnnonce = $ann['typeAnnonce'];
|
||||
$annonce->texteRectificatif = prepareString($ann['texteRectificatif']);
|
||||
$annonce->texteAnnonce = prepareString($ann['texteAnnonce']);
|
||||
$annonce->libFJ = $ann['libFJ'];
|
||||
$annonce->codFJ = $ann['codFJ'];
|
||||
$annonce->capital = $ann['capital'];
|
||||
$annonce->capitalDev = $ann['capitalDev'];
|
||||
|
||||
$annonce->raisonSociale = $ann['raisonSociale'];
|
||||
$annonce->nomCommercial = $ann['nomCommercial'];
|
||||
$annonce->sigle = $ann['sigle'];
|
||||
$annonce->adresse = $ann['adresse'];
|
||||
$annonce->dateEffet = $ann['dateEffet']; //@todo : date
|
||||
$annonce->dateJugement = $ann['dateJugement']; //@todo : date
|
||||
$annonce->dateInsertionSD = $ann['dateInsertionSD']; //@todo : date
|
||||
$annonce->evenements = $evens;
|
||||
$annonce->Lien_Annonce_Pdf = $ann['Lien_Annonce_Pdf'];
|
||||
$annonce->deleted = $ann['deleted'];
|
||||
|
||||
$liste[] = $annonce;
|
||||
}
|
||||
|
||||
if (is_array($annsB))
|
||||
{
|
||||
foreach ($annsB as $nb=>$ann)
|
||||
{
|
||||
//debugLog('I', "Siren/Siret $siren trouvé : ".$etab['Siren'].' '.$etab['Nic'].', '.$etab['Nom'] .', '.$etab['CP'].', '.$etab['Ville'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$evens = array();
|
||||
foreach ($ann['evenements'] as $tabEven)
|
||||
{
|
||||
$even = new AnnonceEvenement();
|
||||
$even->CodeEven = $tabEven['CodeEven'];
|
||||
$even->LibEven = $tabEven['LibEven'];
|
||||
$evens[] = $even;
|
||||
}
|
||||
$annonce = new Annonce();
|
||||
$annonce->id = $ann['id'];
|
||||
$annonce->BodaccCode = $ann['BodaccCode'];
|
||||
$annonce->BodaccNum = $ann['BodaccNum'];
|
||||
$annonce->NumAnnonce = $ann['NumAnnonce'];
|
||||
$annonce->DateParution = $ann['DateParution']; //@todo : date
|
||||
$annonce->Departement = $ann['Departement'];
|
||||
$annonce->Tribunal = $ann['Tribunal'];
|
||||
//$annonce->TribunalCode = $ann['TribunalCode'];
|
||||
$annonce->TribunalSiret = $ann['TribunalSiret'];
|
||||
$annonce->Rubrique = $ann['Rubrique'];
|
||||
$annonce->typeAnnonce = $ann['typeAnnonce'];
|
||||
$annonce->texteRectificatif = prepareString($ann['texteRectificatif']);
|
||||
$annonce->texteAnnonce = utf8_encode($ann['texteAnnonce']);
|
||||
//$annonce->libFJ = $ann['libFJ'];
|
||||
//$annonce->codFJ = $ann['codFJ'];
|
||||
//$annonce->capital = $ann['capital'];
|
||||
//$annonce->capitalDev = $ann['capitalDev'];
|
||||
$annonce->dateEffet = $ann['dateEffet']; //@todo : date
|
||||
$annonce->dateJugement = $ann['dateJugement']; //@todo : date
|
||||
$annonce->dateInsertionSD = $ann['dateInsertionSD']; //@todo : date
|
||||
$annonce->evenements = $evens;
|
||||
$annonce->Lien_Annonce_Pdf = $ann['Lien_Annonce_Pdf'];
|
||||
$annonce->deleted = $ann['deleted'];
|
||||
|
||||
$liste[] = $annonce;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($annsA))
|
||||
{
|
||||
foreach ($annsA as $nb=>$ann)
|
||||
{
|
||||
//debugLog('I', "Siren/Siret $siren trouvé : ".$etab['Siren'].' '.$etab['Nic'].', '.$etab['Nom'] .', '.$etab['CP'].', '.$etab['Ville'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$evens = array();
|
||||
foreach ($ann['evenements'] as $tabEven)
|
||||
{
|
||||
$even = new AnnonceEvenement();
|
||||
$even->CodeEven = $tabEven['CodeEven'];
|
||||
$even->LibEven = $tabEven['LibEven'];
|
||||
$evens[] = $even;
|
||||
}
|
||||
|
||||
$annonce = new Annonce();
|
||||
$annonce->id = $ann['id'];
|
||||
$annonce->BodaccCode = $ann['BodaccCode'];
|
||||
$annonce->BodaccNum = $ann['BodaccNum'];
|
||||
$annonce->NumAnnonce = $ann['NumAnnonce'];
|
||||
$annonce->DateParution = $ann['DateParution']; //@todo : date
|
||||
$annonce->Departement = $ann['Departement'];
|
||||
$annonce->Tribunal = $ann['Tribunal'];
|
||||
//$annonce->TribunalCode = $ann['TribunalCode'];
|
||||
$annonce->TribunalSiret = $ann['TribunalSiret'];
|
||||
$annonce->Rubrique = $ann['Rubrique'];
|
||||
$annonce->typeAnnonce = $ann['typeAnnonce'];
|
||||
$annonce->texteRectificatif = prepareString($ann['texteRectificatif']);
|
||||
$annonce->texteAnnonce = utf8_encode($ann['texteAnnonce']);
|
||||
//$annonce->libFJ = $ann['libFJ'];
|
||||
//$annonce->codFJ = $ann['codFJ'];
|
||||
//$annonce->capital = $ann['capital'];
|
||||
//$annonce->capitalDev = $ann['capitalDev'];
|
||||
//@todo : date
|
||||
$annonce->dateEffet = $ann['dateEffet']; //@todo : date
|
||||
$annonce->dateJugement = $ann['dateJugement']; //@todo : date
|
||||
$annonce->dateInsertionSD = $ann['dateInsertionSD']; //@todo : date
|
||||
$annonce->evenements = $evens;
|
||||
$annonce->Lien_Annonce_Pdf = $ann['Lien_Annonce_Pdf'];
|
||||
$annonce->deleted = $ann['deleted'];
|
||||
|
||||
$liste[] = $annonce;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($annsM))
|
||||
{
|
||||
foreach ($annsM as $nb=>$ann)
|
||||
{
|
||||
$evens = array();
|
||||
foreach ($ann['evenements'] as $tabEven)
|
||||
{
|
||||
$even = new AnnonceEvenement();
|
||||
$even->CodeEven = $tabEven['CodeEven'];
|
||||
$even->LibEven = $tabEven['LibEven'];
|
||||
$evens[] = $even;
|
||||
}
|
||||
|
||||
$annonce = new Annonce();
|
||||
$annonce->id = $ann['id'];
|
||||
$annonce->BodaccCode = $ann['BodaccCode'];
|
||||
$annonce->BodaccNum = $ann['BodaccNum'];
|
||||
$annonce->NumAnnonce = $ann['NumAnnonce'];
|
||||
$annonce->DateParution = $ann['DateParution']; //@todo : date
|
||||
$annonce->Departement = $ann['Departement'];
|
||||
$annonce->Tribunal = $ann['Tribunal'];
|
||||
//$annonce->TribunalCode = $ann['TribunalCode'];
|
||||
$annonce->TribunalSiret = $ann['TribunalSiret'];
|
||||
$annonce->Rubrique = $ann['Rubrique'];
|
||||
$annonce->typeAnnonce = $ann['typeAnnonce'];
|
||||
$annonce->texteRectificatif = prepareString($ann['texteRectificatif']);
|
||||
$annonce->texteAnnonce = utf8_encode($ann['texteAnnonce']);
|
||||
//$annonce->libFJ = $ann['libFJ'];
|
||||
//$annonce->codFJ = $ann['codFJ'];
|
||||
//$annonce->capital = $ann['capital'];
|
||||
//$annonce->capitalDev = $ann['capitalDev'];
|
||||
$annonce->dateEffet = $ann['dateEffet']; //@todo : date
|
||||
$annonce->dateJugement = $ann['dateJugement']; //@todo : date
|
||||
$annonce->dateInsertionSD = $ann['dateInsertionSD']; //@todo : date
|
||||
$annonce->evenements = $evens;
|
||||
$annonce->Lien_Annonce_Pdf = $ann['Lien_Annonce_Pdf'];
|
||||
$annonce->deleted = $ann['deleted'];
|
||||
|
||||
$liste[] = $annonce;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nbReponses = count($liste);
|
||||
if ($nbReponses>0){
|
||||
//$liste = array_slice($liste, $position, $nbRep);
|
||||
}
|
||||
debugLog('I', "Nb Annonces $filtre retournées pour $siren (source=$filtre, id=$idAnn) = ". count($liste), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->wsLog('annonces',$siren,$filtre.'/'.$idAnn);
|
||||
|
||||
$output = new AnnoncesReturn();
|
||||
$output->nbReponses = $nbReponses;
|
||||
$output->result = $liste;
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le nombre d'élément pour chaque type
|
||||
* @param string $siren
|
||||
@ -1646,14 +1381,40 @@ class Entreprise extends WsScore
|
||||
$cpt++;
|
||||
if ($isList===true && $cpt>$nbRep) { break; }
|
||||
|
||||
//@todo : Entites
|
||||
$entites = array();
|
||||
$detailM = new Application_Model_JoBodaccDetail();
|
||||
$sql = $detailM->select()->from($detailM, array(
|
||||
'LPAD(siren, 9, 000000000) AS siren',
|
||||
'LPAD(nic, 5, 00000) AS nic',
|
||||
'raisonSociale','adresse', 'codePostal', 'ville', 'typeEven')
|
||||
)->where('id=?', $ann['id']);
|
||||
$result = $detailM->fetchAll($sql);
|
||||
if (count($result)>0) {
|
||||
foreach ($result as $entity) {
|
||||
$entite = new AnnonceEntite();
|
||||
$entite->siret = $entity->siren.$entity->nic;
|
||||
$entite->raisonSociale = $entity->raisonSociale;
|
||||
|
||||
$iBodacc = new MBodacc();
|
||||
$even = new AnnonceEvenement();
|
||||
$even->CodeEven = $entity->typeEven;
|
||||
$even->LibEven = $iBodacc->getEvenement($entity->typeEven);
|
||||
|
||||
$entite->event = $even;
|
||||
$entites[] = $entite;
|
||||
}
|
||||
}
|
||||
|
||||
//List events
|
||||
$evens = array();
|
||||
foreach ($ann['evenements'] as $tabEven)
|
||||
{
|
||||
foreach ($ann['evenements'] as $tabEven) {
|
||||
$even = new AnnonceEvenement();
|
||||
$even->CodeEven = $tabEven['CodeEven'];
|
||||
$even->LibEven = $tabEven['LibEven'];
|
||||
$evens[] = $even;
|
||||
}
|
||||
|
||||
$annonce = new Annonce();
|
||||
$annonce->id = $ann['id'];
|
||||
$annonce->BodaccCode = $ann['BodaccCode'];
|
||||
@ -1666,22 +1427,12 @@ class Entreprise extends WsScore
|
||||
$annonce->TribunalSiret = $ann['TribunalSiret'];
|
||||
$annonce->Rubrique = $ann['Rubrique'];
|
||||
$annonce->typeAnnonce = $ann['typeAnnonce'];
|
||||
$annonce->texteRectificatif = prepareString($ann['texteRectificatif']);
|
||||
$annonce->texteAnnonce = prepareString($ann['texteAnnonce']);
|
||||
$annonce->libFJ = $ann['libFJ'];
|
||||
$annonce->codFJ = $ann['codFJ'];
|
||||
$annonce->capital = $ann['capital'];
|
||||
$annonce->capitalDev = $ann['capitalDev'];
|
||||
|
||||
$annonce->raisonSociale = $ann['raisonSociale'];
|
||||
$annonce->nomCommercial = $ann['nomCommercial'];
|
||||
$annonce->sigle = $ann['sigle'];
|
||||
$annonce->adresse = $ann['adresse'];
|
||||
$annonce->dateEffet = $ann['dateEffet']; //@todo : date
|
||||
$annonce->dateJugement = $ann['dateJugement']; //@todo : date
|
||||
$annonce->dateInsertionSD = $ann['dateInsertionSD']; //@todo : date
|
||||
$annonce->evenements = $evens;
|
||||
$annonce->Lien_Annonce_Pdf = $ann['Lien_Annonce_Pdf'];
|
||||
$annonce->entites = $entites;
|
||||
$annonce->deleted = $ann['deleted'];
|
||||
|
||||
$liste[] = $annonce;
|
||||
@ -1834,13 +1585,35 @@ class Entreprise extends WsScore
|
||||
}
|
||||
|
||||
$liste = array();
|
||||
if (is_array($anns) && count($anns)>0)
|
||||
{
|
||||
foreach ($anns as $nb=>$ann)
|
||||
{
|
||||
$evens = array();
|
||||
foreach ($ann['evenements'] as $tabEven)
|
||||
{
|
||||
if (is_array($anns) && count($anns)>0) {
|
||||
foreach ($anns as $nb=>$ann) {
|
||||
//Add acheteur
|
||||
|
||||
//Search titulaire
|
||||
$boamplotsM = new Application_Model_JoBoampLots();
|
||||
$sql = $boamplotsM->select()->from($boamplotsM, array(
|
||||
'LPAD(siren, 9, 000000000) AS siren',
|
||||
'LPAD(nic, 5, 00000) AS nic', 'nom','adresse','cp', 'ville', 'pays')
|
||||
)->where('idAnn=?', substr($ann['id'],2));
|
||||
|
||||
$result = $boamplotsM->fetchAll($sql);
|
||||
if (count($result)>0) {
|
||||
foreach ($result as $entity) {
|
||||
$entite = new AnnonceEntite();
|
||||
$entite->siret = $entity->siren.$entity->nic;
|
||||
$entite->raisonSociale = $entity->nom;
|
||||
|
||||
$even = new AnnonceEvenement();
|
||||
//$even->CodeEven = '';
|
||||
$even->LibEven = 'Titulaire';
|
||||
$entite->event = $even;
|
||||
$entites[] = $entite;
|
||||
}
|
||||
}
|
||||
|
||||
//Events
|
||||
$evens = array();
|
||||
foreach ($ann['evenements'] as $tabEven) {
|
||||
$even = new AnnonceEvenement();
|
||||
$even->CodeEven = $tabEven['CodeEven'];
|
||||
$even->LibEven = $tabEven['LibEven'];
|
||||
@ -1869,7 +1642,7 @@ class Entreprise extends WsScore
|
||||
$annonce->dateJugement = $ann['dateJugement']; //@todo : date
|
||||
$annonce->dateInsertionSD = $ann['dateInsertionSD']; //@todo : date
|
||||
$annonce->evenements = $evens;
|
||||
$annonce->Lien_Annonce_Pdf = $ann['Lien_Annonce_Pdf'];
|
||||
$annonce->entites = $entites;
|
||||
$annonce->deleted = $ann['deleted'];
|
||||
|
||||
$liste[] = $annonce;
|
||||
|
@ -1642,44 +1642,12 @@ class Annonce
|
||||
*/
|
||||
public $typeAnnonce;
|
||||
|
||||
/**
|
||||
* Texte si annonce de type Rectificatif, Additif, Suppression
|
||||
* @var string
|
||||
*/
|
||||
public $texteRectificatif;
|
||||
|
||||
/**
|
||||
* Texte complet de l'annonce
|
||||
* @var string
|
||||
*/
|
||||
public $texteAnnonce;
|
||||
|
||||
/**
|
||||
* Libellé de la forme juridique en provenance de l'annonce
|
||||
* @var string
|
||||
*/
|
||||
public $libFJ;
|
||||
|
||||
/**
|
||||
* Code forme juridique de l'entreprise en provenance de l'annonce
|
||||
* @var int
|
||||
* @ref mysql:Liste des Formes juridiques S&D (incluant celles de l'Insee):tabFJur.sql
|
||||
*/
|
||||
public $codFJ;
|
||||
|
||||
/**
|
||||
* Capital issu de l'annonce
|
||||
* @var string
|
||||
*/
|
||||
public $capital;
|
||||
|
||||
/**
|
||||
* Devise ISO du capital de l'entreprise issu de l'annonce
|
||||
* @var string
|
||||
* @ref mysql:Liste des Codes Devise ISO 4217:tabDevises.sql
|
||||
*/
|
||||
public $capitalDev;
|
||||
|
||||
/**
|
||||
* Date d'effet de l'évènement contenu dans l'annonce
|
||||
* @var string
|
||||
@ -1704,12 +1672,6 @@ class Annonce
|
||||
*/
|
||||
public $evenements;
|
||||
|
||||
/**
|
||||
* Si existant, lien vers le fichier PDF disponible en téléchargement
|
||||
* @var string
|
||||
*/
|
||||
public $Lien_Annonce_Pdf;
|
||||
|
||||
/**
|
||||
* Date de suppression
|
||||
* @var string
|
||||
|
Loading…
x
Reference in New Issue
Block a user