diff --git a/application/modules/frontend/controllers/DashboardController.php b/application/modules/frontend/controllers/DashboardController.php index ffae56f8..ceac9027 100644 --- a/application/modules/frontend/controllers/DashboardController.php +++ b/application/modules/frontend/controllers/DashboardController.php @@ -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); diff --git a/application/modules/frontend/controllers/EnrichissementController.php b/application/modules/frontend/controllers/EnrichissementController.php index 11b9bba6..09165263 100644 --- a/application/modules/frontend/controllers/EnrichissementController.php +++ b/application/modules/frontend/controllers/EnrichissementController.php @@ -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 + //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, + $data = array( + '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); + + } diff --git a/application/modules/frontend/models/Tables/EnrichissementCommandes.php b/application/modules/frontend/models/Tables/EnrichissementCommandes.php deleted file mode 100644 index 712bf01e..00000000 --- a/application/modules/frontend/models/Tables/EnrichissementCommandes.php +++ /dev/null @@ -1,5 +0,0 @@ - Tableau de bord > -Enrichissement de fichier +Enrichissement à partir d'un ciblage -Envoyer votre fichier pour enrichissement -

Fichiers en cours d'enrichissement

encours) > 0):?> diff --git a/config/_sql/EnrichissementCommandes.sql b/config/_sql/EnrichissementCommandes.sql deleted file mode 100644 index b65cb392..00000000 --- a/config/_sql/EnrichissementCommandes.sql +++ /dev/null @@ -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; diff --git a/config/_sql/EnrichissementFichiers.sql b/config/_sql/EnrichissementFichiers.sql index 0f7eb594..0e84e4a9 100644 --- a/config/_sql/EnrichissementFichiers.sql +++ b/config/_sql/EnrichissementFichiers.sql @@ -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', - `reference` varchar(50) NOT NULL, - `fichier` int(11) NOT NULL, + `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', + `fichierIn` varchar(100) NOT NULL, + `fichierOut` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8; diff --git a/config/_sql/EnrichissementIdentifiants.sql b/config/_sql/EnrichissementIdentifiants.sql index 03552e06..bb4e7803 100644 --- a/config/_sql/EnrichissementIdentifiants.sql +++ b/config/_sql/EnrichissementIdentifiants.sql @@ -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', - `reference` varchar(50) NOT NULL, + `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;