affichage des enrichissements
This commit is contained in:
parent
003681a91d
commit
57c1766c60
@ -84,13 +84,13 @@ if ( count($identifiants)>0 && count($dataProfil)>0 )
|
||||
$outFile = uniqid($commande->reference.'-').'.csv';
|
||||
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
$dico = new Enrichissement();
|
||||
$dico = new Enrichissement();
|
||||
$fields = $dico->getFields();
|
||||
|
||||
//Entete, Valeur de remplacement et Requete SQL
|
||||
$tabEntete = array('siren', 'nic');
|
||||
$tabEntete = array('siren', 'nic');
|
||||
$tabEnteteLabel = array('SIREN', 'NIC');
|
||||
$sql = 'SELECT siren, nic,';
|
||||
$sql = 'SELECT siren, nic,';
|
||||
foreach ( $dataProfil as $item ) {
|
||||
//Définition de l'entete
|
||||
$tabEnteteLabel[] = $fields[$item]['label'];
|
||||
@ -104,21 +104,22 @@ if ( count($identifiants)>0 && count($dataProfil)>0 )
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Ajouter le champ presentRcs
|
||||
$tabEntete[] = 'presentRcs';
|
||||
$tabEnteteLabel[] = 'RCS';
|
||||
$sql.= ' presentRcs';
|
||||
$tabEntete[] = 'presentRcs';
|
||||
$tabEnteteLabel[] = 'RCS';
|
||||
$sql .= ' presentRcs';
|
||||
|
||||
//Pour chaque identifiant traiter les données
|
||||
$row = 0;
|
||||
$fp = fopen($outFile, 'w');
|
||||
$row = 0;
|
||||
$fp = fopen($outFile, 'w');
|
||||
//Ecrire l'entete
|
||||
if (count($tabEnteteLabel)>0){
|
||||
fputcsv($fp, $tabEnteteLabel, ',', '"');
|
||||
}
|
||||
$model = $sql;
|
||||
$traite = 0;
|
||||
//Date de debut de traitement.
|
||||
$dateStart = date('YmdHms');
|
||||
foreach ($identifiants as $siret )
|
||||
{
|
||||
$sql = $model.' FROM etablissements_act WHERE siren='.substr($siret,0,9).' AND nic='.substr($siret,9,5);
|
||||
@ -138,10 +139,21 @@ if ( count($identifiants)>0 && count($dataProfil)>0 )
|
||||
|
||||
$row++;
|
||||
}
|
||||
$data = array(
|
||||
//Gestion de l'erreur
|
||||
$error = 0;
|
||||
if($traite < $commande['nbLigneTotales'])
|
||||
$error = 1;
|
||||
//date de fin de traitement.
|
||||
$dateStop = date('YmdHms');
|
||||
//Update de la ligne dans la base de donnée.
|
||||
$datas = array(
|
||||
'nbLigneTraites' => $traite,
|
||||
'dateStart' => $dateStart,
|
||||
'dateStop' => $dateStop,
|
||||
'error' => $error,
|
||||
'fichier' => $outFile
|
||||
);
|
||||
|
||||
//Enregistrer les informations.(update des données).
|
||||
$db->update('enrichissement_identifiants', $datas, 'id = '.$opts->id);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user