correction de enrichissement
This commit is contained in:
parent
a638ebf87f
commit
e2c64172fb
@ -63,15 +63,12 @@ $liste = array();
|
||||
|
||||
if ($opts->id)
|
||||
{
|
||||
|
||||
//$commandesM = new Table_EnrichissementCommandes($db);
|
||||
$sql = $db->select()
|
||||
->from('enrichissement_identifiants')
|
||||
->where('idComptage = ?', intval($opts->id));
|
||||
->where('id = ?', intval($opts->id));
|
||||
$commande = $db->fetchRow($sql);
|
||||
$identifiants = json_decode($commande['identifiants'], true);
|
||||
|
||||
//$profilM = new Table_EnrichissementProfils($db);
|
||||
$sql = $db->select()
|
||||
->from('enrichissement_profils')
|
||||
->where('id = ?', $commande['idProfil']);
|
||||
@ -101,12 +98,13 @@ if ( count($identifiants)>0 && count($dataProfil)>0 )
|
||||
|
||||
//Construction de la requete SQL
|
||||
if ( array_key_exists('sql', $fields[$item]) ) {
|
||||
$sql.= '';
|
||||
$sql.= ' '.$fields[$item]['sql'].', ';
|
||||
} else {
|
||||
$sql.= ' '.$fields[$item]['column'].' AS '.$item.',';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Ajouter le champ presentRcs
|
||||
$tabEntete[] = 'presentRcs';
|
||||
$tabEnteteLabel[] = 'RCS';
|
||||
@ -120,10 +118,16 @@ if ( count($identifiants)>0 && count($dataProfil)>0 )
|
||||
fputcsv($fp, $tabEnteteLabel, ',', '"');
|
||||
}
|
||||
$model = $sql;
|
||||
$traite = 0;
|
||||
foreach ($identifiants as $siret )
|
||||
{
|
||||
$sql = $model .' FROM etablissements_act WHERE siren='.substr($siret,0,9).' AND nic='.substr($siret,9,5);
|
||||
$result = $dbMetier->fetchAll($sql);
|
||||
$sql = $model.' FROM etablissements_act WHERE siren='.substr($siret,0,9).' AND nic='.substr($siret,9,5);
|
||||
try {
|
||||
$result = $dbMetier->fetchAll($sql);
|
||||
$traite++;
|
||||
} catch(Exception $e) {
|
||||
echo $sql;
|
||||
}
|
||||
$tabData = $result[0];
|
||||
//Trier pour la sortie
|
||||
$tabSortie = array();
|
||||
@ -134,7 +138,10 @@ if ( count($identifiants)>0 && count($dataProfil)>0 )
|
||||
|
||||
$row++;
|
||||
}
|
||||
echo $row .' Lignes !';
|
||||
$data = array(
|
||||
);
|
||||
|
||||
//Enregistrer les informations.(update des données).
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user