From 4669f48118345c1eb05d86da027de88eacd8e216 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Thu, 13 Mar 2014 13:21:26 +0000 Subject: [PATCH] Annonce TXT --- scripts/jobs/enrichissement.php | 47 ++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/scripts/jobs/enrichissement.php b/scripts/jobs/enrichissement.php index 40f586e4..b707f834 100644 --- a/scripts/jobs/enrichissement.php +++ b/scripts/jobs/enrichissement.php @@ -259,6 +259,7 @@ $tabDico = array( 'multiple' => array( 'actionnaires', 'participations', + 'annoncetxt', ), ); @@ -431,7 +432,7 @@ require_once 'Scores/Enrichissement.php'; $dico = new Enrichissement(); //Liste des champs SQL -foreach($tabExtract as $key) +foreach($tabExtract as $i => $key) { $strKey = false; @@ -504,9 +505,12 @@ foreach($tabExtract as $key) break; } - if ( $element == 'data' && in_array($key, $select) ) + if ( in_array($element, array('data', 'multiple')) && in_array($key, $select) ) { ${$key.'Data'} = $values; + if ( $values ) { + $tabExtract[$i] = $key; + } } } } @@ -713,6 +717,7 @@ foreach($tabIdentifiant as $item) //Retour lignes multiples elseif ( $element == 'multiple' ) { + $values = false; $isSelected = false; foreach($select as $selectItem){ if ( in_array($selectItem, $tabExtract) ) { @@ -722,7 +727,10 @@ foreach($tabIdentifiant as $item) } $retour = array(); if ( $isSelected && function_exists($selectItem.'Multiple') ) { - $retour = call_user_func($selectItem.'Multiple', $siren, $nicV); + if( ${$selectItem.'Data'}!=false ){ + $values = ${$selectItem.'Data'}; + } + $retour = call_user_func($selectItem.'Multiple', $siren, $nicV, $values); } if (count($retour)>0) { $originalLine = $tabNewData[$extendNbRow]; @@ -1782,6 +1790,39 @@ function participationsMultiple($siren, $nic) return $tabData; } +function annoncetxtEntete() +{ + return array( + 'AnnonceLib', + 'AnnonceDate', + 'AnnonceDateParution', + 'AnnonceTxt', + ); +} +function annoncetxtMultiple($siren, $nic, $values = false) +{ + $tabData = array(); + if ( $values!==false ) { + $tabTmp = explode(',', $values); + $iInsee = new MInsee(); + $response = $iInsee->getAnnoncesLegales($siren, 0, $tabTmp, false, true); + foreach ($response as $tabAnn){ + foreach ($tabAnn['evenements'] as $codEve) { + $dateEven = $tabAnn['dateJugement']; + if ($dateEven=='0000-00-00') $dateEven=$tabAnn['dateEffet']; + if ($dateEven=='0000-00-00') $dateEven=$tabAnn['DateParution']; + + $formatElement['AnnonceLib'] = strtr($codEve['LibEven'],array(','=>' ',"'"=>' ','"'=>' ',';'=>' ')); + $formatElement['AnnonceDate'] = $dateEven; + $formatElement['AnnonceDateParution'] = $tabAnn['DateParution']; + $formatElement['AnnonceTxt'] = $tabAnn['texteAnnonce']; + + $tabData[] = $formatElement; + } + } + } + return $tabData; +} /* == FUNCTION == */