From 83d545c0c8bf8fec932c66a87295e60829f2e9f4 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Tue, 19 Mar 2013 08:45:27 +0000 Subject: [PATCH] =?UTF-8?q?issue=20#0001590=20:=20Modification=20du=20code?= =?UTF-8?q?=20pour=20connexion=20sur=20une=20seule=20base=20de=20donn?= =?UTF-8?q?=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/Bootstrap.php | 6 +- .../controllers/ArborescenceController.php | 22 +++--- .../controllers/ComptageController.php | 30 ++++----- .../controllers/DashboardController.php | 24 +++---- .../controllers/EnrichissementController.php | 18 ++--- application/controllers/FieldsController.php | 14 ++-- application/controllers/GestionController.php | 67 ++++++++++++++----- .../scripts/gestion/customerparam.phtml | 2 +- .../scripts/gestion/customerparams.phtml | 4 +- .../default/scripts/gestion/profils.phtml | 4 +- .../Application/Controller/Plugin/Auth.php | 10 +-- .../Controller/Plugin/Comptage.php | 2 +- library/Scores/Ciblage.php | 14 ++-- library/Scores/Enrichissement.php | 2 +- library/Scores/Fields.php | 20 +++--- library/Scores/webservices.ini | 16 ++--- 16 files changed, 143 insertions(+), 112 deletions(-) diff --git a/application/Bootstrap.php b/application/Bootstrap.php index 5c4ccd02..f40bc303 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -7,7 +7,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap Zend_Registry::set('config', $config); return $config; } - + protected function _initViewSettings() { $this->bootstrap('view'); @@ -55,7 +55,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { $c = new Zend_Config($this->getOptions()); try { - $db = Zend_Db::factory($c->profil->db->ciblage); + $db = Zend_Db::factory($c->profil->db->metier); Zend_Db_Table::setDefaultAdapter ($db); } catch ( Exception $e ) { if (APPLICATION_ENV == 'development') { @@ -70,7 +70,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap * Set the default adapter to use with all model */ Zend_Db_Table::setDefaultAdapter($db); - + /** * Set Firebug Database profiler */ diff --git a/application/controllers/ArborescenceController.php b/application/controllers/ArborescenceController.php index 91bfb901..7457fa82 100644 --- a/application/controllers/ArborescenceController.php +++ b/application/controllers/ArborescenceController.php @@ -23,7 +23,7 @@ class ArborescenceController extends Zend_Controller_Action } } - $nafM = new Application_Model_Naf(); + $nafM = new Application_Model_CiblageNaf(); $sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC'); $result = $nafM->fetchAll($sql)->toArray(); @@ -81,7 +81,7 @@ class ArborescenceController extends Zend_Controller_Action } } - $nafM = new Application_Model_Naf(); + $nafM = new Application_Model_CiblageNaf(); $sql = $nafM->select(); if (!empty($parent) && $niveau==2) { @@ -90,7 +90,7 @@ class ArborescenceController extends Zend_Controller_Action $sql->where("code LIKE '".$parent."%'"); } $sql->where('niveau = ?', $niveau)->order('code ASC'); - + $result = $nafM->fetchAll($sql)->toArray(); $tabNaf = array(); foreach($result as $item){ @@ -121,7 +121,7 @@ class ArborescenceController extends Zend_Controller_Action $new = substr($value,0,$niveau); $out = array_merge($out, array($new), $this->getNafParent($new, $niveau1)); } elseif (strlen($value)==2 && $niveau1 === true) { - $nafM = new Application_Model_Naf(); + $nafM = new Application_Model_CiblageNaf(); $sql = $nafM->select() ->from($nafM, array('parent')) ->where('code = ?', $value); @@ -154,7 +154,7 @@ class ArborescenceController extends Zend_Controller_Action } } - $regionsM = new Application_Model_Regions(); + $regionsM = new Application_Model_CiblageRegions(); $sql = $regionsM->select()->order('NCCENR ASC'); $regions = $regionsM->fetchAll($sql)->toArray(); @@ -212,7 +212,7 @@ class ArborescenceController extends Zend_Controller_Action $region = substr($id,1); - $departementsM = new Application_Model_Departements(); + $departementsM = new Application_Model_CiblageDepartements(); $sql = $departementsM->select()->where('codeRegionInsee = ?', $region); $departements = $departementsM->fetchAll($sql)->toArray(); @@ -242,7 +242,7 @@ class ArborescenceController extends Zend_Controller_Action $departement = substr($id,1); - $codePostauxM = new Application_Model_CodePostaux(); + $codePostauxM = new Application_Model_CiblageCodePostaux(); $sql = $codePostauxM->select() ->where('Codepos LIKE ?', $departement.'%') ->order('Commune ASC'); @@ -271,7 +271,7 @@ class ArborescenceController extends Zend_Controller_Action { if (substr($code,0,1)=='D') { - $departementsM = new Application_Model_Departements(); + $departementsM = new Application_Model_CiblageDepartements(); $sql = $departementsM->select() ->from($departementsM, array('codeRegionInsee')) ->where('numdep = ?', substr($code,1)); @@ -281,7 +281,7 @@ class ArborescenceController extends Zend_Controller_Action } elseif ( substr($code,0,1)=='C' ) { - $codePostauxM = new Application_Model_CodePostaux(); + $codePostauxM = new Application_Model_CiblageCodePostaux(); $sql = $codePostauxM->select() ->from($codePostauxM, array('Codepos')) ->where('INSEE = ?', substr($code,1)); @@ -319,7 +319,7 @@ class ArborescenceController extends Zend_Controller_Action } } - $FormeJuridiqueM = new Application_Model_FormeJuridique(); + $FormeJuridiqueM = new Application_Model_CiblageFormeJuridique(); $sql = $FormeJuridiqueM->select() ->where('LENGTH(fjCode) = 1') ->order('fjLibelle ASC'); @@ -385,7 +385,7 @@ class ArborescenceController extends Zend_Controller_Action if ($length<4) { - $FormeJuridiqueM = new Application_Model_FormeJuridique(); + $FormeJuridiqueM = new Application_Model_CiblageFormeJuridique(); $sql = $FormeJuridiqueM->select() ->where('fjCode LIKE "'.$id.'%"') ->where('LENGTH(fjCode)=?', $followingLevel); diff --git a/application/controllers/ComptageController.php b/application/controllers/ComptageController.php index 2dbc92f9..2c9bf66c 100644 --- a/application/controllers/ComptageController.php +++ b/application/controllers/ComptageController.php @@ -18,7 +18,7 @@ class ComptageController extends Zend_Controller_Action * @var int */ $error = 0; - + //Set the flag for exclusion $exclude = $request->getParam('exclude'); $ex = false; @@ -33,15 +33,15 @@ class ComptageController extends Zend_Controller_Action //Informations utilisateur $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - + //Comptage require_once 'Scores/Ciblage.php'; $ciblage = new Ciblage($fields->getValues(), $user->globalRNCS); - + //@todo : if $total = false then an error occured ? // et si nous avons une erreur alors faut-il retirer les critères de la session $total = $ciblage->execute(); - + //Define value return after counting $fields->setNb('total', $total); if ( $user->preferences['interface']['insee'] == 1 ) { @@ -50,7 +50,7 @@ class ComptageController extends Zend_Controller_Action $insee = null; } $fields->setNb('insee', $insee); - + if ( $total !== false ) { //All is ok, save criteres and result to session $fields->setCritereSession(); @@ -60,7 +60,7 @@ class ComptageController extends Zend_Controller_Action } else { $error = 2; } - + //@todo : Ajouter les critères sous forme json_encode //Retour comptage, unité Insee $result = array( @@ -68,7 +68,7 @@ class ComptageController extends Zend_Controller_Action 'insee' => ($insee!==null) ? number_format($insee, 0, '', ' ') : null, 'error' => $error, ); - + $this->view->assign('result', $result); } @@ -86,10 +86,10 @@ class ComptageController extends Zend_Controller_Action public function savedialogAction() { $this->_helper->layout()->disableLayout(); - + $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - + //Récupération de la session pour le profil et les valeurs du comptage $fields = new Scores_Fields(); $criteres = $fields->getCriteres(); @@ -115,7 +115,7 @@ class ComptageController extends Zend_Controller_Action $ref = cleanutf8($ref); $pattern = '/[^a-zA-Z0-9_-]+/'; $ref = preg_replace($pattern, '', $ref); - + if (empty($ref)) { echo json_encode(array( 'error'=>1, @@ -132,7 +132,7 @@ class ComptageController extends Zend_Controller_Action $user = $auth->getIdentity(); //Enregistrement des critères - $criteresM = new Application_Model_Criteres(); + $criteresM = new Application_Model_CiblageCriteres(); $data = array( 'idClient' => $user->idClient, 'login' => $user->username, @@ -152,7 +152,7 @@ class ComptageController extends Zend_Controller_Action } //Enregistrement des valeurs du comptage - $comptageM = new Application_Model_Comptages(); + $comptageM = new Application_Model_CiblageComptages(); $data = array( 'idDefinition' => $id, 'resultat' => $resultat, @@ -185,7 +185,7 @@ class ComptageController extends Zend_Controller_Action $idCriteres = $request->getParam('id'); //Récupération des critères du ciblage - $criteresM = new Application_Model_Criteres(); + $criteresM = new Application_Model_CiblageCriteres(); $criteresRow = $criteresM->find($idCriteres); $criteres = $criteresRow->current(); $structure = json_decode($criteres->criteres, true); @@ -207,7 +207,7 @@ class ComptageController extends Zend_Controller_Action 'dateAjout' => date('YmdHis'), ); //Enregistrement - $comptageM = new Application_Model_Comptages(); + $comptageM = new Application_Model_CiblageComptages(); $comptageM->insert($data); //Retour comptage, unité Insee $result = array( @@ -251,7 +251,7 @@ class ComptageController extends Zend_Controller_Action /** * Make SQL request with the client profil for columns */ - $profilsM = new Application_Model_EnrichissementProfils(); + $profilsM = new Application_Model_CiblageEnrichissementProfils(); $sql = $profilsM->select() ->from($profilsM, array('criteres')) ->where('reference=?','default') diff --git a/application/controllers/DashboardController.php b/application/controllers/DashboardController.php index cbf2f472..49013382 100644 --- a/application/controllers/DashboardController.php +++ b/application/controllers/DashboardController.php @@ -12,7 +12,7 @@ class DashboardController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - $criteresM = new Application_Model_Criteres(); + $criteresM = new Application_Model_CiblageCriteres(); $sql = $criteresM->select() ->from($criteresM, array('id', 'reference', 'dateAjout')) ->where("idClient = ?", $user->idClient) @@ -24,7 +24,7 @@ class DashboardController extends Zend_Controller_Action // $results = array(); - $comptagesM = new Application_Model_Comptages(); + $comptagesM = new Application_Model_CiblageComptages(); foreach($rows->toArray() as $item) { $info = array( @@ -51,7 +51,7 @@ class DashboardController extends Zend_Controller_Action $this->view->comptages = $results; // - $enrichissements = new Application_Model_EnrichissementIdentifiants(); + $enrichissements = new Application_Model_CiblageEnrichissementIdentifiants(); $sql = $enrichissements->select() ->setIntegrityCheck(false) ->from( @@ -82,7 +82,7 @@ class DashboardController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - $criteresM = new Application_Model_Criteres(); + $criteresM = new Application_Model_CiblageCriteres(); //Compter le nombre de page $sql = $criteresM->select() @@ -103,7 +103,7 @@ class DashboardController extends Zend_Controller_Action $rows = $criteresM->fetchAll($sql); $results = array(); - $comptagesM = new Application_Model_Comptages(); + $comptagesM = new Application_Model_CiblageComptages(); foreach($rows->toArray() as $item) { $info = array( @@ -142,7 +142,7 @@ class DashboardController extends Zend_Controller_Action $fields = new Scores_Fields(); //Lecture des paramètres du ciblage - $criteresM = new Application_Model_Criteres(); + $criteresM = new Application_Model_CiblageCriteres(); $sql = $criteresM->select() ->where('idClient = ?', $user->idClient) ->where('login = ?', $user->username) @@ -170,14 +170,14 @@ class DashboardController extends Zend_Controller_Action } //Lecture des comptages - $comptageM = new Application_Model_Comptages(); + $comptageM = new Application_Model_CiblageComptages(); $sql = $comptageM->select() ->where('idDefinition = ?', $comptageId) ->order('dateAjout DESC'); $comptages = $comptageM->fetchAll($sql)->toArray(); //Lecture enrichissement existe - $enrichissementsM = new Application_Model_EnrichissementIdentifiants(); + $enrichissementsM = new Application_Model_CiblageEnrichissementIdentifiants(); $sql = $enrichissementsM->select() ->where('idCriteres = ?', $comptageId); @@ -202,7 +202,7 @@ class DashboardController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); - $criteresM = new Application_Model_Criteres(); + $criteresM = new Application_Model_CiblageCriteres(); $sql = $criteresM->select() ->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date")) ->where("idClient = ?", $user->idClient) @@ -230,7 +230,7 @@ class DashboardController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $user = $auth->getIdentity(); //Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes - $enrichissementsM = new Application_Model_EnrichissementIdentifiants(); + $enrichissementsM = new Application_Model_CiblageEnrichissementIdentifiants(); // Pending $sql = $enrichissementsM->select() @@ -343,7 +343,7 @@ class DashboardController extends Zend_Controller_Action $this->view->assign('tarifText', $tarifText); //List of data to extract - $profilsM = new Application_Model_EnrichissementProfils(); + $profilsM = new Application_Model_CiblageEnrichissementProfils(); $sql = $profilsM->select() ->where('login = ?', $user->username) ->where('idClient = ?', $user->idClient); @@ -378,7 +378,7 @@ class DashboardController extends Zend_Controller_Action $user = $auth->getIdentity(); //Read prefs table to load actual config - $prefsM = new Application_Model_Prefs(); + $prefsM = new Application_Model_CiblagePrefs(); $userPrefs = $prefsM->find($user->username); if ($userPrefs) { diff --git a/application/controllers/EnrichissementController.php b/application/controllers/EnrichissementController.php index b980dbad..774fe2e3 100644 --- a/application/controllers/EnrichissementController.php +++ b/application/controllers/EnrichissementController.php @@ -80,13 +80,13 @@ class EnrichissementController extends Zend_Controller_Action //Identifiant comptage - $comptage = new Application_Model_Comptages(); + $comptage = new Application_Model_CiblageComptages(); $sql = $comptage->select()->where('idDefinition = ?', $idCriteres); $result = $comptage->fetchRow($sql); $idComptage = $result['id']; //Récupération des critères du ciblage - $criteresM = new Application_Model_Criteres(); + $criteresM = new Application_Model_CiblageCriteres(); $criteresRow = $criteresM->find($idCriteres); $criteres = $criteresRow->current(); @@ -125,7 +125,7 @@ class EnrichissementController extends Zend_Controller_Action 'error' => '', 'dateAdded' => date('YmdHis'), ); - $identifiantsM = new Application_Model_EnrichissementIdentifiants(); + $identifiantsM = new Application_Model_CiblageEnrichissementIdentifiants(); $idIdentifiant = $identifiantsM->insert($data); //@todo : ajouter la valeur (prix) du fichier au compteur global afin de décompter du forfait @@ -149,7 +149,7 @@ class EnrichissementController extends Zend_Controller_Action $priceLine = $user->priceLine; //Other profil for this login ? - $profilsM = new Application_Model_EnrichissementProfils(); + $profilsM = new Application_Model_CiblageEnrichissementProfils(); $sql = $profilsM->select() ->from($profilsM, array('id', 'reference', 'criteres')) ->where('actif=1') @@ -176,14 +176,14 @@ class EnrichissementController extends Zend_Controller_Action $this->view->assign('profil', $profilId); $idCritere = $request->getParam('id', null); - $comptagesM = new Application_Model_Comptages(); + $comptagesM = new Application_Model_CiblageComptages(); $sql = $comptagesM->select() ->where('idDefinition = ?', $idCritere) ->order('dateAjout DESC') ->limit(1); $comptages = $comptagesM->fetchAll($sql); - $criteresM = new Application_Model_Criteres(); + $criteresM = new Application_Model_CiblageCriteres(); $criteres = $criteresM->find($idCritere)->current(); $criteresValue = json_decode($criteres->criteres, true); @@ -224,7 +224,7 @@ class EnrichissementController extends Zend_Controller_Action $dateBegin = $user->dateContrat; $dateEnd = date('YmdHis', mktime(0,0,0,substr($user->dateContrat,5,2)+$user->periodContrat, substr($user->dateContrat,8,2), substr($user->dateContrat,0,4))); - $commandesM = new Application_Model_EnrichissementIdentifiants(); + $commandesM = new Application_Model_CiblageEnrichissementIdentifiants(); $sql = $commandesM->select()->setIntegrityCheck(false) ->from( array('commande' => 'enrichissement_identifiants'), array('SUM(nbLigneTotales) as total', 'SUM(uniteInsee) as insee')) ->join( array('critere' => 'ciblage_criteres'), 'critere.id = commande.idCriteres', array()) @@ -271,7 +271,7 @@ class EnrichissementController extends Zend_Controller_Action * Do not download file that not own by the user * List profil */ - $profilM = new Application_Model_EnrichissementProfils(); + $profilM = new Application_Model_CiblageEnrichissementProfils(); $sql = $profilM->select() ->from($profilM, array('id')) ->where('login=?',$identity->username); @@ -287,7 +287,7 @@ class EnrichissementController extends Zend_Controller_Action /* * List finish file */ - $table = new Application_Model_EnrichissementIdentifiants(); + $table = new Application_Model_CiblageEnrichissementIdentifiants(); $sql = $table->select() ->where('idProfil IN('.join(',', $profilList).')') ->where('id = ?', $id); diff --git a/application/controllers/FieldsController.php b/application/controllers/FieldsController.php index 92990df7..861e17b2 100644 --- a/application/controllers/FieldsController.php +++ b/application/controllers/FieldsController.php @@ -51,7 +51,7 @@ class FieldsController extends Zend_Controller_Action */ $queries = explode(' ', $q); $separator = ' , '; - $table = new Application_Model_Naf(); + $table = new Application_Model_CiblageNaf(); $sql = $table->select(); if (count($queries)>0) { $where = ''; @@ -93,7 +93,7 @@ class FieldsController extends Zend_Controller_Action $queries = explode(' ', $q); Zend_Registry::get('firebug')->info($queries); //Région - $table = new Application_Model_Regions(); + $table = new Application_Model_CiblageRegions(); $sql = $table->select(); if (count($queries)>0) { $where = ''; @@ -120,7 +120,7 @@ class FieldsController extends Zend_Controller_Action } //Département - $table = new Application_Model_Departements(); + $table = new Application_Model_CiblageDepartements(); $sql = $table->select(); if (count($queries)>0) { $where = ''; @@ -147,7 +147,7 @@ class FieldsController extends Zend_Controller_Action } //Ville - $table = new Application_Model_CodePostaux(); + $table = new Application_Model_CiblageCodePostaux(); $sql = $table->select(); if (count($queries)>0) { $where = ''; @@ -177,7 +177,7 @@ class FieldsController extends Zend_Controller_Action //Code Département if (strlen($q)==2) { - $table = new Application_Model_Departements(); + $table = new Application_Model_CiblageDepartements(); $sql = $table->select()->where('numdep=?', $q); $result = $table->fetchAll($sql); foreach ($result as $item) { @@ -189,7 +189,7 @@ class FieldsController extends Zend_Controller_Action } //Code Postal - $table = new Application_Model_CodePostaux(); + $table = new Application_Model_CiblageCodePostaux(); $sql = $table->select()->where('Codepos LIKE "'.$q.'%"'); $result = $table->fetchAll($sql); foreach ($result as $item) { @@ -203,7 +203,7 @@ class FieldsController extends Zend_Controller_Action break; case 'cj': - $table = new Application_Model_FormeJuridique(); + $table = new Application_Model_CiblageFormeJuridique(); $separator = ' , '; $sql = $table->select(); diff --git a/application/controllers/GestionController.php b/application/controllers/GestionController.php index 4661192b..ac5e3120 100644 --- a/application/controllers/GestionController.php +++ b/application/controllers/GestionController.php @@ -1,7 +1,9 @@ view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all'); $this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript'); + + //Get Database + $c = Zend_Registry::get('config'); + try { + $this->dbMetier = Zend_Db::factory($c->profil->db->jo); + } catch ( Exception $e ) { + + } } /** @@ -32,7 +42,7 @@ class GestionController extends Zend_Controller_Action $login = $request->getParam('login', ''); $idClient = $request->getParam('idClient', null); - $profilsM = new Application_Model_EnrichissementProfils(); + $profilsM = new Application_Model_CiblageEnrichissementProfils(); $sql = $profilsM->select() ->from($profilsM, array('id', 'idClient', 'login', 'reference', 'tarifLigne', 'dateAjout', 'dateSuppr', 'actif')); @@ -46,6 +56,16 @@ class GestionController extends Zend_Controller_Action $profils = $profilsM->fetchAll($sql); + if ( count($profils)>0 ) { + $clientM = new Application_Model_Sdv1Clients(); + $i = 0; + foreach ($profils as $profil) { + $infoClient = $clientM->find($profil->idClient); + $profils[$i]->nom = $infoClient->nom; + $i++; + } + } + $this->view->assign('profils', $profils); } @@ -66,7 +86,7 @@ class GestionController extends Zend_Controller_Action if ($params['reference']=='default') { //Get default profil - $profilClientM = new Application_Model_CustomerParams(); + $profilClientM = new Application_Model_CiblageCustomerParams(); $sql = $profilClientM->select()->where('idClient=?',$request->getParam('idClient')); $profilClient = $profilClientM->fetchRow($sql); if ( null !== $profilClient ) { @@ -90,7 +110,7 @@ class GestionController extends Zend_Controller_Action 'dateAjout' => date('Y-m-d H:i:s'), 'actif' => 1, ); - $profilM = new Application_Model_EnrichissementProfils(); + $profilM = new Application_Model_CiblageEnrichissementProfils(); if ( $profilM->insert($data) ) { $this->view->assign('message', "Profil enregistré"); $this->view->assign('disableForm', true); @@ -130,7 +150,7 @@ class GestionController extends Zend_Controller_Action $this->view->assign('month', $month); $this->view->assign('year', $year); - $commandesM = new Application_Model_EnrichissementIdentifiants(); + $commandesM = new Application_Model_CiblageEnrichissementIdentifiants(); $sql = $commandesM->select()->setIntegrityCheck(false) ->from('enrichissement_identifiants AS e', array( 'e.id', @@ -165,7 +185,7 @@ class GestionController extends Zend_Controller_Action $this->view->assign('month', $month); $this->view->assign('year', $year); - $commandesM = new Application_Model_EnrichissementIdentifiants(); + $commandesM = new Application_Model_CiblageEnrichissementIdentifiants(); $sql = $commandesM->select()->setIntegrityCheck(false) ->from('enrichissement_identifiants AS e', array( 'e.id', @@ -204,7 +224,7 @@ class GestionController extends Zend_Controller_Action public function extractAction() { $id = $this->getRequest()->getParam('id'); - $table = new Application_Model_EnrichissementIdentifiants(); + $table = new Application_Model_CiblageEnrichissementIdentifiants(); $sql = $table->select()->where('idComptage = ?', $id); $result = $table->fetchRow($sql); if(!empty($result)) { @@ -234,7 +254,7 @@ class GestionController extends Zend_Controller_Action $this->view->assign('month', $month); $this->view->assign('year', $year); - $comptagesM = new Application_Model_Comptages(); + $comptagesM = new Application_Model_CiblageComptages(); $sql = $comptagesM->select()->setIntegrityCheck(false) ->from('ciblage_comptages', array( @@ -266,7 +286,7 @@ class GestionController extends Zend_Controller_Action $id = $request->getParam('id'); //Lecture des paramètres du ciblage - $criteresM = new Application_Model_Criteres(); + $criteresM = new Application_Model_CiblageCriteres(); $sql = $criteresM->select() ->where('id = ?', $id); $criteres = $criteresM->fetchRow($sql)->toArray(); @@ -298,7 +318,7 @@ class GestionController extends Zend_Controller_Action public function customerparamsAction() { //@todo : what's in database - $customersM = new Application_Model_CustomerParams(); + $customersM = new Application_Model_CiblageCustomerParams(); $sql = $customersM->select() ->from($customersM,array('idClient', 'service' , 'dateContrat', 'periodContrat')) ->order('dateAdded DESC') @@ -307,7 +327,8 @@ class GestionController extends Zend_Controller_Action //List login $customerlist = array(); - $profilsM = new Application_Model_EnrichissementProfils(); + $profilsM = new Application_Model_CiblageEnrichissementProfils(); + $clientM = new Application_Model_Sdv1Clients(); foreach($customers as $item) { $sql = $profilsM->select() ->from($profilsM, array('login')) @@ -320,8 +341,12 @@ class GestionController extends Zend_Controller_Action $logins[] = $login['login']; } } - $item['logins'] = $logins; + + $sql = $clientM->select()->where('id=?', $item['idClient']); + $result = $clientM->fetchRow($sql); + $item['nom'] = $result->nom; + $customerlist[] = $item; } $this->view->assign('customerlist', $customerlist); @@ -344,17 +369,23 @@ class GestionController extends Zend_Controller_Action $this->view->assign('idClient', $idClient); if ($idClient !== null) { - $paramsM = new Application_Model_CustomerParams(); + $paramsM = new Application_Model_CiblageCustomerParams(); $sql = $paramsM->select()->where('idClient = ?', $idClient); $params = $paramsM->fetchRow($sql); $infos = null; if ($params!==null){ $infos = $params->toArray(); + + $clientM = new Application_Model_Sdv1Clients(); + $sql = $clientM->select()->where('id=?', $idClient); + $result = $clientM->fetchRow($sql); + $infos['nom'] = $result->nom; + $infos['criteres'] = json_decode($infos['criteres'], true); } $this->view->assign('infos',$infos); - $loginsM = new Application_Model_EnrichissementProfils(); + $loginsM = new Application_Model_CiblageEnrichissementProfils(); $sql = $loginsM->select()->where('idClient = ?', $idClient); $logins = $loginsM->fetchAll($sql)->toArray(); $this->view->assign('logins', $logins); @@ -416,7 +447,7 @@ class GestionController extends Zend_Controller_Action if ($request->getParam('submit')=='Modifier') { //Overwrite default profil for each login try { - $profilM = new Application_Model_EnrichissementProfils(); + $profilM = new Application_Model_CiblageEnrichissementProfils(); $profilM->update(array( 'criteres' => json_encode($params['criteres']) ), "reference='default' AND idClient=".$params['idClient']); @@ -426,7 +457,7 @@ class GestionController extends Zend_Controller_Action //Set parameters try { - $customerParamsM = new Application_Model_CustomerParams(); + $customerParamsM = new Application_Model_CiblageCustomerParams(); $customerParamsM->update($data, 'id='.$params['id']); $this->view->assign('message', "Profil enregistré"); } catch ( Zend_Db_Adapter_Exception $e) { @@ -436,7 +467,7 @@ class GestionController extends Zend_Controller_Action } else { //Set parameters - $customerParamsM = new Application_Model_CustomerParams(); + $customerParamsM = new Application_Model_CiblageCustomerParams(); if ( $customerParamsM->insert($data) ){ $this->view->assign('message', "Profil enregistré"); } else { @@ -452,7 +483,7 @@ class GestionController extends Zend_Controller_Action $idClient = $request->getParam('idClient', null); if ($idClient !== null) { - $paramsM = new Application_Model_CustomerParams(); + $paramsM = new Application_Model_CiblageCustomerParams(); $sql = $paramsM->select()->where('idClient = ?', $idClient); $params = $paramsM->fetchRow($sql); if ( $params!==null ) { diff --git a/application/views/default/scripts/gestion/customerparam.phtml b/application/views/default/scripts/gestion/customerparam.phtml index f0bb1f09..b8304a62 100644 --- a/application/views/default/scripts/gestion/customerparam.phtml +++ b/application/views/default/scripts/gestion/customerparam.phtml @@ -2,7 +2,7 @@

Paramètres client

- + diff --git a/application/views/default/scripts/gestion/customerparams.phtml b/application/views/default/scripts/gestion/customerparams.phtml index c6ff89e1..25540480 100644 --- a/application/views/default/scripts/gestion/customerparams.phtml +++ b/application/views/default/scripts/gestion/customerparams.phtml @@ -8,7 +8,7 @@
idClientinfos['idClient']?>
Nominfos['nom']?>
serviceinfos['service']?>
filterRNCSinfos['filterRNCS']?>
licenceINSEEinfos['licenceINSEE']?>
- + @@ -16,7 +16,7 @@ customerlist as $item) {?> - + - + @@ -24,7 +24,7 @@ IdClient : - Login : profils as $profil ) {?> - + diff --git a/library/Application/Controller/Plugin/Auth.php b/library/Application/Controller/Plugin/Auth.php index 375e5f5f..ae27e21b 100644 --- a/library/Application/Controller/Plugin/Auth.php +++ b/library/Application/Controller/Plugin/Auth.php @@ -67,11 +67,11 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract if ( !isset($identity->dateContrat) && $layout->isEnabled() ) { //Get customer's params - $paramsM = new Application_Model_CustomerParams(); + $paramsM = new Application_Model_CiblageCustomerParams(); $sql = $paramsM->select() - ->where('idClient = ?', $identity->idClient) - //@todo : add service from WebService - ->order('dateContrat DESC')->limit(1); + ->where('idClient = ?', $identity->idClient) + //@todo : add service from WebService + ->order('dateContrat DESC')->limit(1); Zend_Registry::get('firebug')->info($sql->__toString()); $params = $paramsM->fetchAll($sql)->toArray(); @@ -88,7 +88,7 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract } //Get user's preference - $prefsM = new Application_Model_Prefs(); + $prefsM = new Application_Model_CiblagePrefs(); $pref = $prefsM->find($identity->username)->current(); if ($pref) { $identity->preferences = json_decode($pref->json, true); diff --git a/library/Application/Controller/Plugin/Comptage.php b/library/Application/Controller/Plugin/Comptage.php index b4c39973..376497d1 100644 --- a/library/Application/Controller/Plugin/Comptage.php +++ b/library/Application/Controller/Plugin/Comptage.php @@ -33,7 +33,7 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst // Chargement des critères de ciblage à partir de l'enregistrement en bdd $id = $request->getParam('id', 0); if (!empty($id)) { - $criteresM = new Application_Model_Criteres(); + $criteresM = new Application_Model_CiblageCriteres(); $sql = $criteresM->select() ->from($criteresM, array('criteres')) ->where('login = ?', $user->username) diff --git a/library/Scores/Ciblage.php b/library/Scores/Ciblage.php index d34d102e..f6feaacd 100644 --- a/library/Scores/Ciblage.php +++ b/library/Scores/Ciblage.php @@ -240,7 +240,7 @@ class Ciblage protected function minmax($key, $min=null, $max=null) { //Read min max - $minmaxM = new Application_Model_MinMax(); + $minmaxM = new Application_Model_CiblageMinMax(); $minmax = $minmaxM->find($key)->current(); if ($minmax!==false) { @@ -864,7 +864,7 @@ class Ciblage $lastLevel = array(); if ( count($list)>0 ) { - $nafM = new Application_Model_Naf(); + $nafM = new Application_Model_CiblageNaf(); foreach ( $list as $item ) { @@ -984,7 +984,7 @@ class Ciblage break; case 'R': - $departementsM = new Application_Model_Departements(); + $departementsM = new Application_Model_CiblageDepartements(); $sql = $departementsM->select() ->from($departementsM, array('numdep')) ->where('codeRegionInsee = ?', substr($item,1)); @@ -1009,7 +1009,7 @@ class Ciblage break; case 'R': - $departementsM = new Application_Model_Departements(); + $departementsM = new Application_Model_CiblageDepartements(); $sql = $departementsM->select() ->from($departementsM, array('numdep')) ->where('codeRegionInsee = ?', substr($item,1)); @@ -1034,7 +1034,7 @@ class Ciblage //Check if a departement include a codeCommune else remove this codeCommune if (count($departementValueIn)>0) { foreach ( $departementValueIn as $item ) { - $codePostauxM = new Application_Model_CodePostaux(); + $codePostauxM = new Application_Model_CiblageCodePostaux(); $sql = $codePostauxM->select() ->from($codePostauxM, array('INSEE')) ->where('Codepos LIKE ?', $item.'%'); @@ -1055,7 +1055,7 @@ class Ciblage //Check if a departement include a codeCommune else remove this codeCommune if (count($departementValueEx)>0) { foreach ( $departementValueEx as $item ) { - $codePostauxM = new Application_Model_CodePostaux(); + $codePostauxM = new Application_Model_CiblageCodePostaux(); $sql = $codePostauxM->select() ->from($codePostauxM, array('INSEE')) ->where('Codepos LIKE ?', $item.'%'); @@ -1105,7 +1105,7 @@ class Ciblage $childItem = array(); $result = array(); - $fjM = new Application_Model_FormeJuridique(); + $fjM = new Application_Model_CiblageFormeJuridique(); //Only code with a length between 1 and 3 if ( strlen($item)<4 ) { diff --git a/library/Scores/Enrichissement.php b/library/Scores/Enrichissement.php index 02dbd16a..4bb0303e 100644 --- a/library/Scores/Enrichissement.php +++ b/library/Scores/Enrichissement.php @@ -28,7 +28,7 @@ class Enrichissement 'raisonSociale' => array(), //Raison Sociale 'enseigne' => array(), //Enseigne 'sigle' => array(), //Sigle - 'identite_pre' => array(), + 'identite_pre' => array(), //Identite Précédente 'marques' => array(), 'adr_num' => array(), //Adresse 'adr_btq' => array(), //Adresse diff --git a/library/Scores/Fields.php b/library/Scores/Fields.php index 3889e26d..771567b6 100644 --- a/library/Scores/Fields.php +++ b/library/Scores/Fields.php @@ -896,7 +896,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar break; case 'interval': //Read min max - $minmaxM = new Application_Model_MinMax(); + $minmaxM = new Application_Model_CiblageMinMax(); $minmax = $minmaxM->find($sessionKey)->current(); if ($minmax!==false) { $valMin = $minmax->min; @@ -1069,7 +1069,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar */ protected function getMinMax($name) { - $MinMaxM = new Application_Model_MinMax(); + $MinMaxM = new Application_Model_CiblageMinMax(); $minmax = $MinMaxM->fetchAll($MinMaxM->select()->where('cle = ?', $name))->toArray(); return $minmax; } @@ -1110,7 +1110,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar $values = array_map(function($value){ return '"'.$value.'"'; }, $values); $out = array(); - $nafM = new Application_Model_Naf(); + $nafM = new Application_Model_CiblageNaf(); $sql = $nafM->select()->from($nafM, array('lib', 'code'))->where('code IN ('.join(',',$values).')'); $result = $nafM->fetchAll($sql)->toArray(); foreach ( $result as $elem ) { @@ -1128,7 +1128,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar foreach ( $values as $item ) { switch( substr($item,0,1) ) { case 'C': - $communeM = new Application_Model_CodePostaux(); + $communeM = new Application_Model_CiblageCodePostaux(); $sql = $communeM->select()->from($communeM, array('Commune', 'Codepos')) ->where('INSEE = ?', substr($item, 1)); $result = $communeM->fetchAll($sql)->toArray(); @@ -1136,14 +1136,14 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar $out[] = $result[0]['Commune'].' ('.$result[0]['Codepos'].')'; break; case 'D': - $departementsM = new Application_Model_Departements(); + $departementsM = new Application_Model_CiblageDepartements(); $sql = $departementsM->select()->from($departementsM, array('libdep', 'numdep')) ->where('numdep = ?', substr($item, 1)); $result = $departementsM->fetchAll($sql)->toArray(); $out[] = $result[0]['libdep'].' ('.$result[0]['numdep'].')'; break; case 'R': - $regionsM = new Application_Model_Regions(); + $regionsM = new Application_Model_CiblageRegions(); $sql = $regionsM->select()->from($regionsM, array('NCCENR'))->where('REGION = ?', substr($item,1)); $result = $regionsM->fetchAll($sql)->toArray(); $out[] = $result[0]['NCCENR']; @@ -1156,7 +1156,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar public function getValueLabelCodespostaux($values) { foreach ( $values as $item ) { - $communeM = new Application_Model_CodePostaux(); + $communeM = new Application_Model_CiblageCodePostaux(); $sql = $communeM->select()->from($communeM, array('Commune'))->where('Codepos = ?', $item); $result = $communeM->fetchAll($sql)->toArray(); $strCommunes = ''; @@ -1172,7 +1172,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar public function getValueLabelCodesdepts($values) { foreach ( $values as $item ) { - $departementsM = new Application_Model_Departements(); + $departementsM = new Application_Model_CiblageDepartements(); $sql = $departementsM->select()->from($departementsM, array('libdep'))->where('numdep = ?', $item); $result = $departementsM->fetchAll($sql)->toArray(); $out[] = $item.' ('.$result[0]['libdep'].')'; @@ -1183,7 +1183,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar public function getValueLabelCodeinsee($values) { foreach ( $values as $item ) { - $communeM = new Application_Model_CodePostaux(); + $communeM = new Application_Model_CiblageCodePostaux(); $sql = $communeM->select()->from($communeM, array('Commune'))->where('INSEE = ?', $item); $result = $communeM->fetchAll($sql)->toArray(); $out[] = $item.' ('.$result[0]['Commune'].')'; @@ -1196,7 +1196,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar $values = array_map(function($value){ return '"'.$value.'"'; }, $values); $out = array(); - $fjM = new Application_Model_FormeJuridique(); + $fjM = new Application_Model_CiblageFormeJuridique(); $sql = $fjM->select()->from($fjM, array('fjLibelle', 'fjCode'))->where('fjCode IN ('.join(',',$values).')'); $result = $fjM->fetchAll($sql)->toArray(); foreach ( $result as $elem ) { diff --git a/library/Scores/webservices.ini b/library/Scores/webservices.ini index e7e8d5c9..63f1d0fb 100644 --- a/library/Scores/webservices.ini +++ b/library/Scores/webservices.ini @@ -1,21 +1,21 @@ [local] -webservices.interne.wsdl = "http://webservice-2.3.sd.dev/interne/v0.3?wsdl-auto" +webservices.interne.wsdl = "http://webservice-2.4.sd.dev/interne/v0.3?wsdl-auto" webservices.interne.options.soap_version = SOAP_1_2 -webservices.entreprise.wsdl = "http://webservice-2.3.sd.dev/entreprise/v0.4?wsdl-auto" +webservices.entreprise.wsdl = "http://webservice-2.4.sd.dev/entreprise/v0.4?wsdl-auto" webservices.entreprise.options.soap_version = SOAP_1_2 -webservices.gestion.wsdl = "http://webservice-2.3.sd.dev/gestion/v0.1?wsdl-auto" +webservices.gestion.wsdl = "http://webservice-2.4.sd.dev/gestion/v0.1?wsdl-auto" webservices.gestion.options.soap_version = SOAP_1_2 -webservices.exporter.wsdl = "http://webservice-2.3.sd.dev/exporter/v0.1?wsdl-auto" +webservices.exporter.wsdl = "http://webservice-2.4.sd.dev/exporter/v0.1?wsdl-auto" webservices.exporter.options.soap_version = SOAP_1_2 [sdsrvdev01] -webservices.interne.wsdl = "http://webservice-2.3.sd.lan/interne/v0.3?wsdl-auto" +webservices.interne.wsdl = "http://webservice-2.4.sd.lan/interne/v0.3?wsdl-auto" webservices.interne.options.soap_version = SOAP_1_2 -webservices.entreprise.wsdl = "http://webservice-2.3.sd.lan/entreprise/v0.4?wsdl-auto" +webservices.entreprise.wsdl = "http://webservice-2.4.sd.lan/entreprise/v0.4?wsdl-auto" webservices.entreprise.options.soap_version = SOAP_1_2 -webservices.gestion.wsdl = "http://webservice-2.3.sd.lan/gestion/v0.1?wsdl-auto" +webservices.gestion.wsdl = "http://webservice-2.4.sd.lan/gestion/v0.1?wsdl-auto" webservices.gestion.options.soap_version = SOAP_1_2 -webservices.exporter.wsdl = "http://webservice-2.3.sd.lan/exporter/v0.1?wsdl-auto" +webservices.exporter.wsdl = "http://webservice-2.4.sd.lan/exporter/v0.1?wsdl-auto" webservices.exporter.options.soap_version = SOAP_1_2 [sd-25137]
idClientNom Début du contrat Durée contrat Logins ouvert
diff --git a/application/views/default/scripts/gestion/profils.phtml b/application/views/default/scripts/gestion/profils.phtml index 4ca67eb0..ac88ea59 100644 --- a/application/views/default/scripts/gestion/profils.phtml +++ b/application/views/default/scripts/gestion/profils.phtml @@ -12,7 +12,7 @@ IdClient : - Login :
idClientNom login reference tarifLigne