From 4d9951d9d48b96a19c9c29d1b3844c917b63ade0 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Mon, 11 Jun 2012 14:40:07 +0000 Subject: [PATCH] Add customer params and correct exclude on NAF --- application/configs/application.ini | 1 + application/controllers/AideController.php | 6 ++ .../controllers/ComptageController.php | 26 ++++--- .../controllers/DashboardController.php | 4 ++ .../controllers/EnrichissementController.php | 4 +- application/controllers/GestionController.php | 30 +++++++++ application/controllers/IndexController.php | 9 +-- application/models/CustomerParams.php | 5 ++ .../views/default/scripts/aide/index.phtml | 6 ++ .../views/default/scripts/aide/message.phtml | 8 +++ .../scripts/dashboard/configuration.phtml | 23 +++++-- .../scripts/gestion/customerparam.phtml | 6 ++ .../scripts/gestion/customerparams.phtml | 5 ++ .../views/default/scripts/gestion/index.phtml | 8 ++- .../default/scripts/gestion/profiladd.phtml | 9 +-- config/_sql/CustomerParams.sql | 15 +++++ .../Application/Controller/Plugin/Auth.php | 3 + .../Controller/Plugin/Comptage.php | 2 +- .../Application/Controller/Plugin/Params.php | 51 ++++++++++++++ library/Scores/AuthAdapter.php | 12 ---- library/Scores/Ciblage.php | 67 +++++++++++++++---- library/Scores/Fields.php | 4 ++ 22 files changed, 248 insertions(+), 56 deletions(-) create mode 100644 application/models/CustomerParams.php create mode 100644 application/views/default/scripts/aide/message.phtml create mode 100644 application/views/default/scripts/gestion/customerparam.phtml create mode 100644 application/views/default/scripts/gestion/customerparams.phtml create mode 100644 config/_sql/CustomerParams.sql create mode 100644 library/Application/Controller/Plugin/Params.php diff --git a/application/configs/application.ini b/application/configs/application.ini index 13e7e762..47c72773 100644 --- a/application/configs/application.ini +++ b/application/configs/application.ini @@ -13,6 +13,7 @@ resources.session.cookie_lifetime = 86400 resources.session.remember_me_seconds = 86400 resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth" +resources.frontController.plugins.Auth = "Application_Controller_Plugin_Params" resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage" resources.frontController.params.displayExceptions = 0 resources.layout.layout = "main" diff --git a/application/controllers/AideController.php b/application/controllers/AideController.php index f496e985..f6fd59fd 100644 --- a/application/controllers/AideController.php +++ b/application/controllers/AideController.php @@ -11,4 +11,10 @@ class AideController extends Zend_Controller_Action public function aproposdeAction(){} + public function messageAction() + { + $request = $this->getRequest(); + $this->view->assign('typeMsg', $request->getParam('typeMsg')); + } + } \ No newline at end of file diff --git a/application/controllers/ComptageController.php b/application/controllers/ComptageController.php index 9f298387..23cdd805 100644 --- a/application/controllers/ComptageController.php +++ b/application/controllers/ComptageController.php @@ -18,23 +18,25 @@ class ComptageController extends Zend_Controller_Action //Set the flag for exclusion $exclude = $request->getParam('exclude'); $ex = false; - if ( !empty($exclude) ) { + if ( intval($exclude)==1 ) { $ex = true; } $fields = new Scores_Fields(); $fields->setCritere($cle, $valeur, $ex); + + //Informations utilisateur + $auth = Zend_Auth::getInstance(); + $user = $auth->getIdentity(); //Comptage require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage($fields->getValues()); + $ciblage = new Ciblage($fields->getValues(), $user->filterRNCS); //@todo : if $total = false then an error occured ? $total = $ciblage->execute(); $fields->setNb('total', $total); - $auth = Zend_Auth::getInstance(); - $user = $auth->getIdentity(); if ($user->preferences['interface']['insee']==1) { $insee = $ciblage->calculRedevanceInsee(); } else { @@ -113,7 +115,7 @@ class ComptageController extends Zend_Controller_Action //If nbInsee == null, need to count again if ($nbInsee===null) { require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage($criteres); + $ciblage = new Ciblage($criteres, $user->filterRNCS); $nbInsee = $ciblage->calculRedevanceInsee(); } @@ -159,9 +161,12 @@ class ComptageController extends Zend_Controller_Action $field = new Scores_Fields(); $values = $field->getValues($structure); + $auth = Zend_Auth::getInstance(); + $user = $auth->getIdentity(); + //Comptage require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage($values); + $ciblage = new Ciblage($values, $user->filterRNCS); $data = array( 'idDefinition' => $idCriteres, @@ -189,11 +194,14 @@ class ComptageController extends Zend_Controller_Action { $this->_helper->layout()->disableLayout(); + $auth = Zend_Auth::getInstance(); + $user = $auth->getIdentity(); + $fields = new Scores_Fields(); //Comptage require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage($fields->getValues()); + $ciblage = new Ciblage($fields->getValues(), $user->filterRNCS); $sirets = $ciblage->execute(true, 10); $dbConfig = Zend_Registry::get('configuration')->databases; @@ -203,9 +211,7 @@ class ComptageController extends Zend_Controller_Action exit ( $e->getMessage() ); } - //Make SQL request with the user profil for columns - $auth = Zend_Auth::getInstance(); - $user = $auth->getIdentity(); + //Make SQL request with the user profil for columns $profilsM = new Application_Model_EnrichissementProfils(); $sql = $profilsM->select() ->where('login = ?', $user->username) diff --git a/application/controllers/DashboardController.php b/application/controllers/DashboardController.php index 2d5614cb..841533c5 100644 --- a/application/controllers/DashboardController.php +++ b/application/controllers/DashboardController.php @@ -303,6 +303,8 @@ class DashboardController extends Zend_Controller_Action } } + //Customer params have an option on the RNCS filter + $this->view->assign('filterRNCS', $user->filterRNCS); } /** @@ -357,6 +359,8 @@ class DashboardController extends Zend_Controller_Action $nbRow = $prefsM->update(array('json'=>$newjson), "login='".$user->username."'"); + //Don't forget to save new preferences in session + $this->view->assign('nbRow', $nbRow); } diff --git a/application/controllers/EnrichissementController.php b/application/controllers/EnrichissementController.php index f2b06e0e..534984a2 100644 --- a/application/controllers/EnrichissementController.php +++ b/application/controllers/EnrichissementController.php @@ -78,7 +78,7 @@ class EnrichissementController extends Zend_Controller_Action $ref = $request->getParam('ref'); //Vérifier les profils du client - if ( $idProfil===null ){ + if ( $idProfil===null ) { //Selection du profil du client $auth = Zend_Auth::getInstance(); @@ -108,7 +108,7 @@ class EnrichissementController extends Zend_Controller_Action //Récupération des SIRET require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage($structure, true); + $ciblage = new Ciblage($structure, $user->filterRNCS); $infosExtraction = $ciblage->execute(true); diff --git a/application/controllers/GestionController.php b/application/controllers/GestionController.php index 85cf33e7..61f0a210 100644 --- a/application/controllers/GestionController.php +++ b/application/controllers/GestionController.php @@ -232,4 +232,34 @@ class GestionController extends Zend_Controller_Action $this->view->comptages = $comptages; } + /** + * List customers + */ + public function customerparamsAction() + { + //@todo : Get customer list from webservice + + } + + + /** + * List customer's params + */ + public function customerparamAction() + { + $request = $this->getRequest(); + + $idClient= $request->getParam('id', null); + + if ($idClient !== null) { + $paramsM = new Application_Model_CustomerParams(); + $params = $paramsM->find($idClient); + $infos = null; + if ($params->count()>0){ + $infos = $params->toArray(); + } + $this->view->assign('infos',$infos); + } + } + } \ No newline at end of file diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index 42a6721d..0f09b241 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -95,17 +95,18 @@ class IndexController extends Zend_Controller_Action $fields->unsetCritereValue($nameCritereToDelete, $posExList, true); } else { $fields->unsetCritere($nameCritereToDelete); - } + } + + $auth = Zend_Auth::getInstance(); + $user = $auth->getIdentity(); //Comptage require_once 'Scores/Ciblage.php'; - $ciblage = new Ciblage($fields->getValues()); + $ciblage = new Ciblage($fields->getValues(), $user->filterRNCS); $total = $ciblage->execute(); $fields->setNb('total', $total); - $auth = Zend_Auth::getInstance(); - $user = $auth->getIdentity(); if ($user->preferences['interface']['insee']==1) { $insee = $ciblage->calculRedevanceInsee(); } else { diff --git a/application/models/CustomerParams.php b/application/models/CustomerParams.php new file mode 100644 index 00000000..741c93ce --- /dev/null +++ b/application/models/CustomerParams.php @@ -0,0 +1,5 @@ +

Description de l'interface

+

+Menu + +Résumé des critères + +


diff --git a/application/views/default/scripts/aide/message.phtml b/application/views/default/scripts/aide/message.phtml new file mode 100644 index 00000000..e349a2e7 --- /dev/null +++ b/application/views/default/scripts/aide/message.phtml @@ -0,0 +1,8 @@ +
+typeMsg == 'support') {?> +Les paramètres de votre compte n'ont pas été définis.
Veuillez contacter le support. +
Par mail : support@scores-decisions.com +
Par téléphone : 00 00 00 00 00 +
Ou contactez votre commercial. + +
\ No newline at end of file diff --git a/application/views/default/scripts/dashboard/configuration.phtml b/application/views/default/scripts/dashboard/configuration.phtml index 527dda33..5524238d 100644 --- a/application/views/default/scripts/dashboard/configuration.phtml +++ b/application/views/default/scripts/dashboard/configuration.phtml @@ -13,7 +13,7 @@
-

Gestion des profils d'enrichissement

+

Profils d'enrichissement

Afin de vous permettre un enrichissement de données à partir d'une liste de SIREN/SIRET, Suivant la configuration de votre compte, vous avez la possibilité de sélectionner les données @@ -33,7 +33,7 @@ disponible.

Lister les colonnes disponibles (Association SQL/Libellé) pour la configuration

-

Gestion des préférences d'affichage

+

Préférences d'affichage

L'application permet la modification de l'affichage des critères de ciblage afin de permettre une utilisation correspondant à vos besoins. @@ -50,14 +50,20 @@ utilisation correspondant à vos besoins.
Pour permettre une estimation du cout de la redevance INSEE, en activant cette option, le nombre d'unité insee est affiché à chaque comptage
-prefInterfaceInsee==1) echo ' checked="checked"';?> /> +prefInterfaceInsee==1) echo ' checked="checked"';?> +filterRNCS==1) echo ' disabled="disable"';?>/>



Les éléments soumis à redevance INSEE sont automatiquement retirer du ciblage
-prefFilterRncs==1) echo ' checked="checked"';?> /> +prefFilterRncs==1) echo ' checked="checked"';?> +filterRNCS==1) echo ' disabled="disable"';?> />
+filterRNCS==1) {?> +Votre compte est paramétré pour filtrer RNCS + +