Ajout préambule de l'action commande
This commit is contained in:
parent
c88eb0c2fb
commit
a7d3ac6158
@ -70,8 +70,59 @@ class EnrichissementController extends Zend_Controller_Action
|
||||
*/
|
||||
public function commandeAction()
|
||||
{
|
||||
$object = new Object_Comptage();
|
||||
return ($object->extract());
|
||||
$request = $this->getRequest();
|
||||
$idCriteres = $request->getParam('id', null);
|
||||
|
||||
//Récupération des critères du ciblage
|
||||
$criteresM = new Table_Criteres();
|
||||
$criteresRow = $criteresM->find($idCriteres);
|
||||
$criteres = $criteresRow->current();
|
||||
|
||||
$structure = json_decode($criteres->criteres, true);
|
||||
|
||||
//Actualisation du comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($structure);
|
||||
$infosExtraction = $ciblage->extract();
|
||||
|
||||
//Enregistrement du nouveau comptage
|
||||
$data = array(
|
||||
'idDefinition' => $criteres->id,
|
||||
'resultat' => $infosExtraction['total'],
|
||||
'uniteInsee' => $infosExtraction['insee'],
|
||||
'dateAjout' => date('YmdHis'),
|
||||
);
|
||||
$comptagesM = new Table_Comptages();
|
||||
$idComptage = $comptagesM->insert($data);
|
||||
|
||||
//Récupération des SIRET
|
||||
$data = array(
|
||||
'idComptage' => $idComptage,
|
||||
'identifiants' => $infosExtraction['result'],
|
||||
);
|
||||
$identifiantsM = new Table_EnrichissementIdentifiants();
|
||||
$idIdentifiant = $identifiantsM->insert($data);
|
||||
|
||||
//Mise en attente de l'enrichissement
|
||||
$idProfil = $request->getParam('profil');
|
||||
//Vérifier les profils du client
|
||||
|
||||
//Attention calcul uniteInsee réelle
|
||||
//car si donnée insee alors toutes les lignes doivent être comptés en unité insee
|
||||
|
||||
$data = array(
|
||||
'idIdentifiant' => $idIdentifiant,
|
||||
'idProfil' => $idProfil,
|
||||
'fichier' => '',
|
||||
'nbLigneTotales' => $infosExtraction['total'],
|
||||
'nbLigneTraites' => '',
|
||||
'uniteInsee' => $infosExtraction['insee'],
|
||||
'error' => '',
|
||||
'dateAdded' => date('YmdHis'),
|
||||
);
|
||||
$commandesM = new Table_EnrichissementCommandes();
|
||||
$commandesM->insert($data);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user