On laisse dans le fichier les siren faux
This commit is contained in:
parent
fcd0df8095
commit
fa05294b71
@ -447,76 +447,77 @@ foreach($tabIdentifiant as $item)
|
||||
$tabData[$row]['SiretValide'] = ($siretValide===true) ? 1 : 0;
|
||||
|
||||
if ( $sirenValide===false || intval($siren)==0 ){
|
||||
$row++;
|
||||
continue;
|
||||
}
|
||||
//Siren faux
|
||||
} else {
|
||||
|
||||
//Vérifier les nic, ou sélectionner le nic du siege actif
|
||||
$nicV = $nic; //Surcharge pour le nic
|
||||
$strNic = '';
|
||||
$sqlNic = 'SELECT nic as nicTmp, cj as cjTmp FROM jo.etablissements WHERE siren='.$siren;
|
||||
if (strlen($item)==14 && intval($nic)>0){
|
||||
$stmt = $dbMetier->query($sqlNic.' AND nic='.$nic);
|
||||
$result = $stmt->fetchAll();
|
||||
if (count($result)==0){
|
||||
$nicV = 0;
|
||||
$fJur = '0000';
|
||||
} else {
|
||||
//nic : On considère qu'il est vrai si on a un résultat
|
||||
$fJur = $result[0]['cjTmp'];
|
||||
}
|
||||
}
|
||||
|
||||
if (intval($nicV)==0){
|
||||
$strNic = ' AND nic>-1 AND actif>-1 ORDER BY siege DESC, actif DESC, nicTmp DESC LIMIT 0,1';
|
||||
$stmt = $dbMetier->query($sqlNic.$strNic);
|
||||
$result = $stmt->fetchAll();
|
||||
if (count($result)>0){
|
||||
$nicV = $result[0]['nicTmp'];
|
||||
$fJur = $result[0]['cjTmp'];
|
||||
} else {
|
||||
$nicV = '00000';
|
||||
$fJur = '0000';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $posKeySiren!==false && $posKeyNic!==false ){
|
||||
$tabData[$row]['siren'] = $siren;
|
||||
$tabData[$row]['nic'] = $nic;
|
||||
}
|
||||
|
||||
//Récupération des données
|
||||
foreach($tabDico as $element => $select)
|
||||
{
|
||||
//Traitement par requete SQL
|
||||
if (isset(${$element.'Fields'})){
|
||||
$where = $select['where'];
|
||||
eval( "\$where = \"$where\";" );
|
||||
${$element.'SQL'} = 'SELECT '.${$element.'Fields'}.' FROM '.$select['db'].$where;
|
||||
$stmt = $dbMetier->query(${$element.'SQL'});
|
||||
//Vérifier les nic, ou sélectionner le nic du siege actif
|
||||
$nicV = $nic; //Surcharge pour le nic
|
||||
$strNic = '';
|
||||
$sqlNic = 'SELECT nic as nicTmp, cj as cjTmp FROM jo.etablissements WHERE siren='.$siren;
|
||||
if (strlen($item)==14 && intval($nic)>0){
|
||||
$stmt = $dbMetier->query($sqlNic.' AND nic='.$nic);
|
||||
$result = $stmt->fetchAll();
|
||||
if (count($result)>0){
|
||||
$tabData[$row] = array_merge( $tabData[$row] , $result[0]);
|
||||
if (count($result)==0){
|
||||
$nicV = 0;
|
||||
$fJur = '0000';
|
||||
} else {
|
||||
//nic : On considère qu'il est vrai si on a un résultat
|
||||
$fJur = $result[0]['cjTmp'];
|
||||
}
|
||||
}
|
||||
//Traitement par fonction
|
||||
if( $element == 'data' )
|
||||
|
||||
if (intval($nicV)==0){
|
||||
$strNic = ' AND nic>-1 AND actif>-1 ORDER BY siege DESC, actif DESC, nicTmp DESC LIMIT 0,1';
|
||||
$stmt = $dbMetier->query($sqlNic.$strNic);
|
||||
$result = $stmt->fetchAll();
|
||||
if (count($result)>0){
|
||||
$nicV = $result[0]['nicTmp'];
|
||||
$fJur = $result[0]['cjTmp'];
|
||||
} else {
|
||||
$nicV = '00000';
|
||||
$fJur = '0000';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $posKeySiren!==false && $posKeyNic!==false ){
|
||||
$tabData[$row]['siren'] = $siren;
|
||||
$tabData[$row]['nic'] = $nic;
|
||||
}
|
||||
|
||||
//Récupération des données
|
||||
foreach($tabDico as $element => $select)
|
||||
{
|
||||
foreach($select as $item)
|
||||
{
|
||||
if (isset(${$item.'Data'}))
|
||||
{
|
||||
$values = false;
|
||||
if( ${$item.'Data'}!=false ){
|
||||
$values = ${$item.'Data'};
|
||||
}
|
||||
$retour = call_user_func($item.'Data', $siren, $nicV, $values);
|
||||
$tabData[$row] = $tabData[$row] + $retour;
|
||||
//Traitement par requete SQL
|
||||
if (isset(${$element.'Fields'})){
|
||||
$where = $select['where'];
|
||||
eval( "\$where = \"$where\";" );
|
||||
${$element.'SQL'} = 'SELECT '.${$element.'Fields'}.' FROM '.$select['db'].$where;
|
||||
$stmt = $dbMetier->query(${$element.'SQL'});
|
||||
$result = $stmt->fetchAll();
|
||||
if (count($result)>0){
|
||||
$tabData[$row] = array_merge( $tabData[$row] , $result[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Traitement par fonction
|
||||
if( $element == 'data' )
|
||||
{
|
||||
foreach($select as $item)
|
||||
{
|
||||
if (isset(${$item.'Data'}))
|
||||
{
|
||||
$values = false;
|
||||
if( ${$item.'Data'}!=false ){
|
||||
$values = ${$item.'Data'};
|
||||
}
|
||||
$retour = call_user_func($item.'Data', $siren, $nicV, $values);
|
||||
$tabData[$row] = $tabData[$row] + $retour;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Trier pour la sortie
|
||||
$tabSortie = array();
|
||||
foreach($tabEntete as $key){
|
||||
|
Loading…
Reference in New Issue
Block a user