Meilleur sélection du siege (siege=2)
This commit is contained in:
parent
508f42d941
commit
bf82895a6a
@ -513,7 +513,7 @@ foreach($tabIdentifiant as $item)
|
||||
//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;
|
||||
$sqlNic = 'SELECT nic AS nicTmp, cj AS cjTmp, IF(siege=1,1,0) AS triSiege FROM jo.etablissements WHERE siren='.$siren;
|
||||
|
||||
//Si identifiant est un siret, char(14) alors on vérifie que le NIC existe
|
||||
if (strlen($item)==14 && intval($nic)>0){
|
||||
@ -529,7 +529,7 @@ foreach($tabIdentifiant as $item)
|
||||
}
|
||||
|
||||
if (intval($nicV)==0){
|
||||
$strNic = ' AND nic>-1 AND actif>-1 ORDER BY siege DESC, actif DESC, nicTmp DESC LIMIT 0,1';
|
||||
$strNic = ' AND nic>-1 AND actif>-1 ORDER BY triSiege DESC, actif DESC, nicTmp DESC LIMIT 0,1';
|
||||
$stmt = $dbMetier->query($sqlNic.$strNic);
|
||||
$result = $stmt->fetchAll();
|
||||
if (count($result)>0){
|
||||
@ -554,7 +554,6 @@ foreach($tabIdentifiant as $item)
|
||||
$where = $select['where'];
|
||||
eval( "\$where = \"$where\";" );
|
||||
${$element.'SQL'} = 'SELECT '.${$element.'Fields'}.' FROM '.$select['db'].$where;
|
||||
|
||||
try {
|
||||
$stmt = $dbMetier->query(${$element.'SQL'});
|
||||
$result = $stmt->fetchAll();
|
||||
@ -598,6 +597,7 @@ foreach($tabIdentifiant as $item)
|
||||
foreach($tabEntete as $key){
|
||||
$tabSortie[] = isset($tabData[$row][$key]) ? $tabData[$row][$key] : '';
|
||||
}
|
||||
|
||||
fputcsv($fp, $tabSortie, ',', '"');
|
||||
|
||||
$row++;
|
||||
|
Loading…
Reference in New Issue
Block a user