modification de l'enrichissement + recomptage (actualisation du comptage) et rapelle des criteres
This commit is contained in:
parent
3993257e59
commit
18bd65b991
@ -64,7 +64,6 @@ class EnrichissementController extends Zend_Controller_Action
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enregistrement de la commande pour l'ennrichissement
|
||||
*/
|
||||
@ -103,7 +102,6 @@ class EnrichissementController extends Zend_Controller_Action
|
||||
$criteres = $criteresRow->current();
|
||||
|
||||
$structure = json_decode($criteres->criteres, true);
|
||||
|
||||
require_once 'Scores/Field.php';
|
||||
$field = new Fields();
|
||||
$values = $field->getValues($structure);
|
||||
@ -129,6 +127,7 @@ class EnrichissementController extends Zend_Controller_Action
|
||||
'error' => '',
|
||||
'dateAdded' => date('YmdHis'),
|
||||
);
|
||||
|
||||
$identifiantsM = new Table_EnrichissementIdentifiants();
|
||||
$idIdentifiant = $identifiantsM->insert($data);
|
||||
}
|
||||
@ -165,10 +164,28 @@ class EnrichissementController extends Zend_Controller_Action
|
||||
->order('dateAjout DESC')
|
||||
->limit(1);
|
||||
$comptages = $comptagesM->fetchAll($sql);
|
||||
$old = $comptages;
|
||||
$oldResultat = $old[0]->resultat;
|
||||
$oldResultatInsee = $old[0]->uniteInsee;
|
||||
if ( $comptages->count()>0 ) {
|
||||
$item = $comptages[0];
|
||||
//@todo : Si le ciblage n'est pas du jour, refaire le comptage par rapport aux critères de ciblage
|
||||
|
||||
$date = explode(' ', $item->dateAjout);
|
||||
$date = $date[0];
|
||||
if($date != '0000-00-00') {
|
||||
if($date != date('Y-m-d')) {
|
||||
$criteres = new Table_Criteres();
|
||||
$sql = $criteres->select()->where('id = ?', $idCritere);
|
||||
$result = $criteres->fetchRow($sql)->toArray();
|
||||
$criteres = json_decode($result['criteres'], true);
|
||||
require_once('Scores/Field.php');
|
||||
require_once('Scores/Ciblage.php');
|
||||
$field = new Fields();
|
||||
$count = new Ciblage($field->getValues($criteres));
|
||||
$item['resultat'] = $count->execute();
|
||||
$item['uniteInsee'] = $count->calculRedevanceInsee();
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->assign('resultat', $item['resultat']);
|
||||
$this->view->assign('uniteInsee', $item['uniteInsee']);
|
||||
|
||||
@ -182,10 +199,18 @@ class EnrichissementController extends Zend_Controller_Action
|
||||
}
|
||||
$prix = $item['resultat'] * $profil->tarifLigne + $prixInsee;
|
||||
|
||||
$this->view->assign('prix', $prix);
|
||||
$this->view->assign('prixInsee', $prixInsee);
|
||||
$this->view->assign('infoInsee', $infoInsee);
|
||||
$this->view->assign('id', $item['id']);
|
||||
$this->view->prix = round($prix, 2);
|
||||
$this->view->prixInsee = round($prixInsee, 2);
|
||||
$this->view->infoInsee = $infoInsee;
|
||||
$this->view->id = $item['id'];
|
||||
|
||||
$this->view->oldDate = $date;
|
||||
$this->view->oldResult = $oldResultat;
|
||||
$this->view->oldResultInsee = $oldResultatInsee;
|
||||
$this->view->oldPrice = round($oldResultat* $profil->tarifLigne + $oldResultatInsee, 2);
|
||||
$this->view->oldPriceInsee = round($oldResultatInsee*$redevanceInsee, 2);
|
||||
|
||||
$this->view->criteres = $criteres;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user