Amélioration + formattage
This commit is contained in:
parent
605c11cde3
commit
ef3c5889a7
@ -59,8 +59,8 @@ try {
|
||||
|
||||
$id = null;
|
||||
|
||||
if ($opts->cron)
|
||||
{
|
||||
// --- Execute by cron
|
||||
if ($opts->cron) {
|
||||
$commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
|
||||
|
||||
$sql = $commandesM->select()
|
||||
@ -86,27 +86,32 @@ if ($opts->cron)
|
||||
}
|
||||
}
|
||||
|
||||
if ($opts->id)
|
||||
{
|
||||
// --- Set ID if given
|
||||
if ($opts->id) {
|
||||
$id = $opts->id;
|
||||
}
|
||||
|
||||
if ($id !== null)
|
||||
{
|
||||
// --- Read SIRETs
|
||||
$commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
|
||||
$commande = $commandesM->find(intval($id))->current();
|
||||
$identifiants = json_decode($commande->identifiants, true);
|
||||
|
||||
// --- Read profil for data extract
|
||||
$profilM = new Application_Model_CiblageEnrichissementProfils();
|
||||
$profil = $profilM->find(intval($commande->idProfil))->current();
|
||||
$dataProfil = json_decode($profil->criteres, true);
|
||||
// --- Control order ID
|
||||
if ( $id === null ) {
|
||||
echo date('Y-m-d H:i:s') . " - Aucun identifiant de commande\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// --- Read SIRETs from order
|
||||
$commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
|
||||
$commande = $commandesM->find(intval($id))->current();
|
||||
$identifiants = json_decode($commande->identifiants, true);
|
||||
|
||||
// --- Read profil for data extract
|
||||
$profilM = new Application_Model_CiblageEnrichissementProfils();
|
||||
$profil = $profilM->find(intval($commande->idProfil))->current();
|
||||
$dataProfil = json_decode($profil->criteres, true);
|
||||
|
||||
$fileFormat = 'csv';
|
||||
|
||||
// --- Something is needed
|
||||
if ( count($identifiants)==0 || count($dataProfil)==0 ) {
|
||||
//echo "Identifiants:".count($identifiants).", profil:".$count($profil)."\n";
|
||||
echo date('Y-m-d H:i:s') . " - Erreur information de commande\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -114,11 +119,11 @@ if ( count($identifiants)==0 || count($dataProfil)==0 ) {
|
||||
$mois = substr($commande->dateAdded,0,4).substr($commande->dateAdded,5,2);
|
||||
|
||||
$path = $config->profil->path->data.'/'.$mois;
|
||||
if(!file_exists($path))
|
||||
if( !file_exists($path) ) {
|
||||
mkdir($path);
|
||||
}
|
||||
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
$dico = new Enrichissement();
|
||||
$dico = new Scores_Ciblage_Extract();
|
||||
$fields = $dico->getFields();
|
||||
|
||||
// --- Entete, Valeur de remplacement et Requete SQL
|
||||
@ -280,7 +285,7 @@ foreach ($identifiants as $siret)
|
||||
foreach($tabSortie as $col => $value) {
|
||||
$sheet->setCellValueByColumnAndRow($col, $row+1, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Mise à jour des lignes traitées dans la base
|
||||
|
Loading…
Reference in New Issue
Block a user