Suppression de la table Enrichissement_Commandes

This commit is contained in:
Michael RICOIS 2012-02-27 09:36:49 +00:00
parent aade0196ae
commit a76be3aae3
7 changed files with 49 additions and 62 deletions

View File

@ -17,24 +17,20 @@ class DashboardController extends Libs_Controller
//Affichage des derniers enrichissements
$enrichissementsM = new Table_EnrichissementCommandes();
$enrichissementsM = new Table_EnrichissementIdentifiants();
$sql = $enrichissementsM->select()
->setIntegrityCheck(false)
->from(
array('i' => 'enrichissement_identifiants'),
array('reference')
)
->join(
array('cmd' => 'enrichissement_commandes'), 'i.idCommande = cmd.id',
array('id', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
)
->join(
array('c' => 'comptages'), 'i.idComptage = c.id',
array('')
)
->join(
array('criteres' => 'criteres'), 'c.idDefinition = criteres.id',
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
array('')
)
->where('criteres.idClient = ?', $user->idClient)
@ -67,10 +63,6 @@ class DashboardController extends Libs_Controller
$this->view->criteres = $comptage['criteres'];
$this->view->comptages = $comptage['comptages'];
}
public function rcomptageAction()
@ -112,35 +104,31 @@ class DashboardController extends Libs_Controller
$user = $auth->getIdentity();
//Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes
$enrichissementsM = new Table_EnrichissementCommandes();
$enrichissementsM = new Table_EnrichissementIdentifiants();
$sql = $enrichissementsM->select()
->setIntegrityCheck(false)
->from(
array('i' => 'enrichissement_identifiants'),
array('reference')
)
->join(
array('cmd' => 'enrichissement_commandes'), 'i.idCommande = cmd.id',
array('id', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
)
->join(
array('c' => 'comptages'), 'i.idComptage = c.id',
array('')
)
->join(
array('criteres' => 'criteres'), 'c.idDefinition = criteres.id',
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
array('')
);
$sql->where('cmd.dateStop = ?', 0)
$sql->where('i.dateStop = ?', 0)
->where('criteres.idClient = ?', $user->idClient)
->where('criteres.login = ?', $user->username);
$encours = $enrichissementsM->fetchAll($sql);
$this->view->assign('encours', $encours);
$sql->where('cmd.dateStop != ?', 0)
$sql->where('i.dateStop != ?', 0)
->where('criteres.idClient = ?', $user->idClient)
->where('criteres.login = ?', $user->username);
$fini = $enrichissementsM->fetchAll($sql);

View File

@ -72,6 +72,13 @@ class EnrichissementController extends Zend_Controller_Action
{
$request = $this->getRequest();
$idCriteres = $request->getParam('id', null);
$idProfil = $request->getParam('profil', null);
//Vérifier les profils du client
if ( $idProfil===null ){
//Selection du profil du client
}
//Récupération des critères du ciblage
$criteresM = new Table_Criteres();
@ -100,22 +107,15 @@ class EnrichissementController extends Zend_Controller_Action
$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,
'idComptage' => $idComptage,
'idCriteres' => $criteres->id,
'idProfil' => $idProfil,
'identifiants' => $infosExtraction['result'],
'idProfil' => $idProfil,
'fichier' => '',
'nbLigneTotales' => $infosExtraction['total'],
@ -124,8 +124,10 @@ class EnrichissementController extends Zend_Controller_Action
'error' => '',
'dateAdded' => date('YmdHis'),
);
$commandesM = new Table_EnrichissementCommandes();
$commandesM->insert($data);
$identifiantsM = new Table_EnrichissementIdentifiants();
$idIdentifiant = $identifiantsM->insert($data);
}

View File

@ -1,5 +0,0 @@
<?php
class Table_EnrichissementCommandes extends Zend_Db_Table_Abstract
{
public $_name = 'enrichissement_commandes';
}

View File

@ -2,11 +2,9 @@
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
Enrichissement de fichier
Enrichissement à partir d'un ciblage
</div>
<a href="<?=$this->url(array('controller'=>'enrichissement', 'action'=>'fileform'))?>">Envoyer votre fichier pour enrichissement</a>
<h2>Fichiers en cours d'enrichissement</h2>
<?php if(count($this->encours) > 0):?>

View File

@ -1,14 +0,0 @@
CREATE TABLE IF NOT EXISTS `enrichissement_commandes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idIdentifiant` int(11) NOT NULL,
`idProfil` int(11) NOT NULL,
`fichier` varchar(100) NOT NULL,
`nbLigneTotales` int(11) NOT NULL,
`nbLigneTraites` int(11) NOT NULL,
`uniteInsee` int(11) NOT NULL DEFAULT '0',
`error` varchar(100) NOT NULL,
`dateAdded` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateStart` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateStop` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;

View File

@ -1,7 +1,16 @@
CREATE TABLE IF NOT EXISTS `enrichissement_fichiers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idCommande` int(11) NOT NULL DEFAULT '0',
`idProfil` int(11) NOT NULL,
`reference` varchar(50) NOT NULL,
`fichier` int(11) NOT NULL,
`identifiants` longtext NOT NULL,
`nbLigneTotales` int(11) NOT NULL,
`nbLigneTraites` int(11) NOT NULL,
`uniteInsee` int(11) NOT NULL DEFAULT '0',
`error` varchar(100) NOT NULL,
`dateAdded` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateStart` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateStop` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`fichierIn` varchar(100) NOT NULL,
`fichierOut` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;

View File

@ -1,8 +1,17 @@
CREATE TABLE IF NOT EXISTS `enrichissement_identifiants` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idComptage` int(11) NOT NULL,
`idCommande` int(11) NOT NULL DEFAULT '0',
`idCriteres` int(11) NOT NULL DEFAULT '0',
`idProfil` int(11) NOT NULL,
`reference` varchar(50) NOT NULL,
`identifiants` longtext NOT NULL,
`nbLigneTotales` int(11) NOT NULL,
`nbLigneTraites` int(11) NOT NULL,
`uniteInsee` int(11) NOT NULL DEFAULT '0',
`error` varchar(100) NOT NULL,
`dateAdded` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateStart` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`dateStop` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`fichier` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;