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