Merge Branch 1.3 - Main update is the move of database

This commit is contained in:
Michael RICOIS 2013-04-12 07:05:42 +00:00
commit e14e96610a
52 changed files with 291 additions and 244 deletions

View File

@ -55,7 +55,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{ {
$c = new Zend_Config($this->getOptions()); $c = new Zend_Config($this->getOptions());
try { try {
$db = Zend_Db::factory($c->profil->db->ciblage); $db = Zend_Db::factory($c->profil->db->metier);
Zend_Db_Table::setDefaultAdapter ($db); Zend_Db_Table::setDefaultAdapter ($db);
} catch ( Exception $e ) { } catch ( Exception $e ) {
if (APPLICATION_ENV == 'development') { if (APPLICATION_ENV == 'development') {

View File

@ -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'); $sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray(); $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(); $sql = $nafM->select();
if (!empty($parent) && $niveau==2) { if (!empty($parent) && $niveau==2) {
@ -121,7 +121,7 @@ class ArborescenceController extends Zend_Controller_Action
$new = substr($value,0,$niveau); $new = substr($value,0,$niveau);
$out = array_merge($out, array($new), $this->getNafParent($new, $niveau1)); $out = array_merge($out, array($new), $this->getNafParent($new, $niveau1));
} elseif (strlen($value)==2 && $niveau1 === true) { } elseif (strlen($value)==2 && $niveau1 === true) {
$nafM = new Application_Model_Naf(); $nafM = new Application_Model_CiblageNaf();
$sql = $nafM->select() $sql = $nafM->select()
->from($nafM, array('parent')) ->from($nafM, array('parent'))
->where('code = ?', $value); ->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'); $sql = $regionsM->select()->order('NCCENR ASC');
$regions = $regionsM->fetchAll($sql)->toArray(); $regions = $regionsM->fetchAll($sql)->toArray();
@ -212,7 +212,7 @@ class ArborescenceController extends Zend_Controller_Action
$region = substr($id,1); $region = substr($id,1);
$departementsM = new Application_Model_Departements(); $departementsM = new Application_Model_CiblageDepartements();
$sql = $departementsM->select()->where('codeRegionInsee = ?', $region); $sql = $departementsM->select()->where('codeRegionInsee = ?', $region);
$departements = $departementsM->fetchAll($sql)->toArray(); $departements = $departementsM->fetchAll($sql)->toArray();
@ -242,7 +242,7 @@ class ArborescenceController extends Zend_Controller_Action
$departement = substr($id,1); $departement = substr($id,1);
$codePostauxM = new Application_Model_CodePostaux(); $codePostauxM = new Application_Model_CiblageCodePostaux();
$sql = $codePostauxM->select() $sql = $codePostauxM->select()
->where('Codepos LIKE ?', $departement.'%') ->where('Codepos LIKE ?', $departement.'%')
->order('Commune ASC'); ->order('Commune ASC');
@ -271,7 +271,7 @@ class ArborescenceController extends Zend_Controller_Action
{ {
if (substr($code,0,1)=='D') { if (substr($code,0,1)=='D') {
$departementsM = new Application_Model_Departements(); $departementsM = new Application_Model_CiblageDepartements();
$sql = $departementsM->select() $sql = $departementsM->select()
->from($departementsM, array('codeRegionInsee')) ->from($departementsM, array('codeRegionInsee'))
->where('numdep = ?', substr($code,1)); ->where('numdep = ?', substr($code,1));
@ -281,7 +281,7 @@ class ArborescenceController extends Zend_Controller_Action
} elseif ( substr($code,0,1)=='C' ) { } elseif ( substr($code,0,1)=='C' ) {
$codePostauxM = new Application_Model_CodePostaux(); $codePostauxM = new Application_Model_CiblageCodePostaux();
$sql = $codePostauxM->select() $sql = $codePostauxM->select()
->from($codePostauxM, array('Codepos')) ->from($codePostauxM, array('Codepos'))
->where('INSEE = ?', substr($code,1)); ->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() $sql = $FormeJuridiqueM->select()
->where('LENGTH(fjCode) = 1') ->where('LENGTH(fjCode) = 1')
->order('fjLibelle ASC'); ->order('fjLibelle ASC');
@ -385,7 +385,7 @@ class ArborescenceController extends Zend_Controller_Action
if ($length<4) { if ($length<4) {
$FormeJuridiqueM = new Application_Model_FormeJuridique(); $FormeJuridiqueM = new Application_Model_CiblageFormeJuridique();
$sql = $FormeJuridiqueM->select() $sql = $FormeJuridiqueM->select()
->where('fjCode LIKE "'.$id.'%"') ->where('fjCode LIKE "'.$id.'%"')
->where('LENGTH(fjCode)=?', $followingLevel); ->where('LENGTH(fjCode)=?', $followingLevel);

View File

@ -132,7 +132,7 @@ class ComptageController extends Zend_Controller_Action
$user = $auth->getIdentity(); $user = $auth->getIdentity();
//Enregistrement des critères //Enregistrement des critères
$criteresM = new Application_Model_Criteres(); $criteresM = new Application_Model_CiblageCriteres();
$data = array( $data = array(
'idClient' => $user->idClient, 'idClient' => $user->idClient,
'login' => $user->username, 'login' => $user->username,
@ -152,7 +152,7 @@ class ComptageController extends Zend_Controller_Action
} }
//Enregistrement des valeurs du comptage //Enregistrement des valeurs du comptage
$comptageM = new Application_Model_Comptages(); $comptageM = new Application_Model_CiblageComptages();
$data = array( $data = array(
'idDefinition' => $id, 'idDefinition' => $id,
'resultat' => $resultat, 'resultat' => $resultat,
@ -185,7 +185,7 @@ class ComptageController extends Zend_Controller_Action
$idCriteres = $request->getParam('id'); $idCriteres = $request->getParam('id');
//Récupération des critères du ciblage //Récupération des critères du ciblage
$criteresM = new Application_Model_Criteres(); $criteresM = new Application_Model_CiblageCriteres();
$criteresRow = $criteresM->find($idCriteres); $criteresRow = $criteresM->find($idCriteres);
$criteres = $criteresRow->current(); $criteres = $criteresRow->current();
$structure = json_decode($criteres->criteres, true); $structure = json_decode($criteres->criteres, true);
@ -207,7 +207,7 @@ class ComptageController extends Zend_Controller_Action
'dateAjout' => date('YmdHis'), 'dateAjout' => date('YmdHis'),
); );
//Enregistrement //Enregistrement
$comptageM = new Application_Model_Comptages(); $comptageM = new Application_Model_CiblageComptages();
$comptageM->insert($data); $comptageM->insert($data);
//Retour comptage, unité Insee //Retour comptage, unité Insee
$result = array( $result = array(
@ -251,7 +251,7 @@ class ComptageController extends Zend_Controller_Action
/** /**
* Make SQL request with the client profil for columns * Make SQL request with the client profil for columns
*/ */
$profilsM = new Application_Model_EnrichissementProfils(); $profilsM = new Application_Model_CiblageEnrichissementProfils();
$sql = $profilsM->select() $sql = $profilsM->select()
->from($profilsM, array('criteres')) ->from($profilsM, array('criteres'))
->where('reference=?','default') ->where('reference=?','default')

View File

@ -12,7 +12,7 @@ class DashboardController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$criteresM = new Application_Model_Criteres(); $criteresM = new Application_Model_CiblageCriteres();
$sql = $criteresM->select() $sql = $criteresM->select()
->from($criteresM, array('id', 'reference', 'dateAjout')) ->from($criteresM, array('id', 'reference', 'dateAjout'))
->where("idClient = ?", $user->idClient) ->where("idClient = ?", $user->idClient)
@ -24,7 +24,7 @@ class DashboardController extends Zend_Controller_Action
// //
$results = array(); $results = array();
$comptagesM = new Application_Model_Comptages(); $comptagesM = new Application_Model_CiblageComptages();
foreach($rows->toArray() as $item) foreach($rows->toArray() as $item)
{ {
$info = array( $info = array(
@ -51,7 +51,7 @@ class DashboardController extends Zend_Controller_Action
$this->view->comptages = $results; $this->view->comptages = $results;
// //
$enrichissements = new Application_Model_EnrichissementIdentifiants(); $enrichissements = new Application_Model_CiblageEnrichissementIdentifiants();
$sql = $enrichissements->select() $sql = $enrichissements->select()
->setIntegrityCheck(false) ->setIntegrityCheck(false)
->from( ->from(
@ -82,7 +82,7 @@ class DashboardController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$criteresM = new Application_Model_Criteres(); $criteresM = new Application_Model_CiblageCriteres();
//Compter le nombre de page //Compter le nombre de page
$sql = $criteresM->select() $sql = $criteresM->select()
@ -103,7 +103,7 @@ class DashboardController extends Zend_Controller_Action
$rows = $criteresM->fetchAll($sql); $rows = $criteresM->fetchAll($sql);
$results = array(); $results = array();
$comptagesM = new Application_Model_Comptages(); $comptagesM = new Application_Model_CiblageComptages();
foreach($rows->toArray() as $item) foreach($rows->toArray() as $item)
{ {
$info = array( $info = array(
@ -142,7 +142,7 @@ class DashboardController extends Zend_Controller_Action
$fields = new Scores_Fields(); $fields = new Scores_Fields();
//Lecture des paramètres du ciblage //Lecture des paramètres du ciblage
$criteresM = new Application_Model_Criteres(); $criteresM = new Application_Model_CiblageCriteres();
$sql = $criteresM->select() $sql = $criteresM->select()
->where('idClient = ?', $user->idClient) ->where('idClient = ?', $user->idClient)
->where('login = ?', $user->username) ->where('login = ?', $user->username)
@ -170,14 +170,14 @@ class DashboardController extends Zend_Controller_Action
} }
//Lecture des comptages //Lecture des comptages
$comptageM = new Application_Model_Comptages(); $comptageM = new Application_Model_CiblageComptages();
$sql = $comptageM->select() $sql = $comptageM->select()
->where('idDefinition = ?', $comptageId) ->where('idDefinition = ?', $comptageId)
->order('dateAjout DESC'); ->order('dateAjout DESC');
$comptages = $comptageM->fetchAll($sql)->toArray(); $comptages = $comptageM->fetchAll($sql)->toArray();
//Lecture enrichissement existe //Lecture enrichissement existe
$enrichissementsM = new Application_Model_EnrichissementIdentifiants(); $enrichissementsM = new Application_Model_CiblageEnrichissementIdentifiants();
$sql = $enrichissementsM->select() $sql = $enrichissementsM->select()
->where('idCriteres = ?', $comptageId); ->where('idCriteres = ?', $comptageId);
@ -202,7 +202,7 @@ class DashboardController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$criteresM = new Application_Model_Criteres(); $criteresM = new Application_Model_CiblageCriteres();
$sql = $criteresM->select() $sql = $criteresM->select()
->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date")) ->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date"))
->where("idClient = ?", $user->idClient) ->where("idClient = ?", $user->idClient)
@ -230,7 +230,7 @@ class DashboardController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$user = $auth->getIdentity(); $user = $auth->getIdentity();
//Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes //Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes
$enrichissementsM = new Application_Model_EnrichissementIdentifiants(); $enrichissementsM = new Application_Model_CiblageEnrichissementIdentifiants();
// Pending // Pending
$sql = $enrichissementsM->select() $sql = $enrichissementsM->select()
@ -343,7 +343,7 @@ class DashboardController extends Zend_Controller_Action
$this->view->assign('tarifText', $tarifText); $this->view->assign('tarifText', $tarifText);
//List of data to extract //List of data to extract
$profilsM = new Application_Model_EnrichissementProfils(); $profilsM = new Application_Model_CiblageEnrichissementProfils();
$sql = $profilsM->select() $sql = $profilsM->select()
->where('login = ?', $user->username) ->where('login = ?', $user->username)
->where('idClient = ?', $user->idClient); ->where('idClient = ?', $user->idClient);
@ -378,7 +378,7 @@ class DashboardController extends Zend_Controller_Action
$user = $auth->getIdentity(); $user = $auth->getIdentity();
//Read prefs table to load actual config //Read prefs table to load actual config
$prefsM = new Application_Model_Prefs(); $prefsM = new Application_Model_CiblagePrefs();
$userPrefs = $prefsM->find($user->username); $userPrefs = $prefsM->find($user->username);
if ($userPrefs) { if ($userPrefs) {

View File

@ -80,13 +80,13 @@ class EnrichissementController extends Zend_Controller_Action
//Identifiant comptage //Identifiant comptage
$comptage = new Application_Model_Comptages(); $comptage = new Application_Model_CiblageComptages();
$sql = $comptage->select()->where('idDefinition = ?', $idCriteres); $sql = $comptage->select()->where('idDefinition = ?', $idCriteres);
$result = $comptage->fetchRow($sql); $result = $comptage->fetchRow($sql);
$idComptage = $result['id']; $idComptage = $result['id'];
//Récupération des critères du ciblage //Récupération des critères du ciblage
$criteresM = new Application_Model_Criteres(); $criteresM = new Application_Model_CiblageCriteres();
$criteresRow = $criteresM->find($idCriteres); $criteresRow = $criteresM->find($idCriteres);
$criteres = $criteresRow->current(); $criteres = $criteresRow->current();
@ -125,7 +125,7 @@ class EnrichissementController extends Zend_Controller_Action
'error' => '', 'error' => '',
'dateAdded' => date('YmdHis'), 'dateAdded' => date('YmdHis'),
); );
$identifiantsM = new Application_Model_EnrichissementIdentifiants(); $identifiantsM = new Application_Model_CiblageEnrichissementIdentifiants();
$idIdentifiant = $identifiantsM->insert($data); $idIdentifiant = $identifiantsM->insert($data);
//@todo : ajouter la valeur (prix) du fichier au compteur global afin de décompter du forfait //@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; $priceLine = $user->priceLine;
//Other profil for this login ? //Other profil for this login ?
$profilsM = new Application_Model_EnrichissementProfils(); $profilsM = new Application_Model_CiblageEnrichissementProfils();
$sql = $profilsM->select() $sql = $profilsM->select()
->from($profilsM, array('id', 'reference', 'criteres')) ->from($profilsM, array('id', 'reference', 'criteres'))
->where('actif=1') ->where('actif=1')
@ -176,14 +176,14 @@ class EnrichissementController extends Zend_Controller_Action
$this->view->assign('profil', $profilId); $this->view->assign('profil', $profilId);
$idCritere = $request->getParam('id', null); $idCritere = $request->getParam('id', null);
$comptagesM = new Application_Model_Comptages(); $comptagesM = new Application_Model_CiblageComptages();
$sql = $comptagesM->select() $sql = $comptagesM->select()
->where('idDefinition = ?', $idCritere) ->where('idDefinition = ?', $idCritere)
->order('dateAjout DESC') ->order('dateAjout DESC')
->limit(1); ->limit(1);
$comptages = $comptagesM->fetchAll($sql); $comptages = $comptagesM->fetchAll($sql);
$criteresM = new Application_Model_Criteres(); $criteresM = new Application_Model_CiblageCriteres();
$criteres = $criteresM->find($idCritere)->current(); $criteres = $criteresM->find($idCritere)->current();
$criteresValue = json_decode($criteres->criteres, true); $criteresValue = json_decode($criteres->criteres, true);
@ -224,7 +224,7 @@ class EnrichissementController extends Zend_Controller_Action
$dateBegin = $user->dateContrat; $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))); $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) $sql = $commandesM->select()->setIntegrityCheck(false)
->from( array('commande' => 'enrichissement_identifiants'), array('SUM(nbLigneTotales) as total', 'SUM(uniteInsee) as insee')) ->from( array('commande' => 'enrichissement_identifiants'), array('SUM(nbLigneTotales) as total', 'SUM(uniteInsee) as insee'))
->join( array('critere' => 'ciblage_criteres'), 'critere.id = commande.idCriteres', array()) ->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 * Do not download file that not own by the user
* List profil * List profil
*/ */
$profilM = new Application_Model_EnrichissementProfils(); $profilM = new Application_Model_CiblageEnrichissementProfils();
$sql = $profilM->select() $sql = $profilM->select()
->from($profilM, array('id')) ->from($profilM, array('id'))
->where('login=?',$identity->username); ->where('login=?',$identity->username);
@ -287,7 +287,7 @@ class EnrichissementController extends Zend_Controller_Action
/* /*
* List finish file * List finish file
*/ */
$table = new Application_Model_EnrichissementIdentifiants(); $table = new Application_Model_CiblageEnrichissementIdentifiants();
$sql = $table->select() $sql = $table->select()
->where('idProfil IN('.join(',', $profilList).')') ->where('idProfil IN('.join(',', $profilList).')')
->where('id = ?', $id); ->where('id = ?', $id);

View File

@ -51,7 +51,7 @@ class FieldsController extends Zend_Controller_Action
*/ */
$queries = explode(' ', $q); $queries = explode(' ', $q);
$separator = ' , '; $separator = ' , ';
$table = new Application_Model_Naf(); $table = new Application_Model_CiblageNaf();
$sql = $table->select(); $sql = $table->select();
if (count($queries)>0) { if (count($queries)>0) {
$where = ''; $where = '';
@ -93,7 +93,7 @@ class FieldsController extends Zend_Controller_Action
$queries = explode(' ', $q); $queries = explode(' ', $q);
Zend_Registry::get('firebug')->info($queries); Zend_Registry::get('firebug')->info($queries);
//Région //Région
$table = new Application_Model_Regions(); $table = new Application_Model_CiblageRegions();
$sql = $table->select(); $sql = $table->select();
if (count($queries)>0) { if (count($queries)>0) {
$where = ''; $where = '';
@ -120,7 +120,7 @@ class FieldsController extends Zend_Controller_Action
} }
//Département //Département
$table = new Application_Model_Departements(); $table = new Application_Model_CiblageDepartements();
$sql = $table->select(); $sql = $table->select();
if (count($queries)>0) { if (count($queries)>0) {
$where = ''; $where = '';
@ -147,7 +147,7 @@ class FieldsController extends Zend_Controller_Action
} }
//Ville //Ville
$table = new Application_Model_CodePostaux(); $table = new Application_Model_CiblageCodePostaux();
$sql = $table->select(); $sql = $table->select();
if (count($queries)>0) { if (count($queries)>0) {
$where = ''; $where = '';
@ -177,7 +177,7 @@ class FieldsController extends Zend_Controller_Action
//Code Département //Code Département
if (strlen($q)==2) { if (strlen($q)==2) {
$table = new Application_Model_Departements(); $table = new Application_Model_CiblageDepartements();
$sql = $table->select()->where('numdep=?', $q); $sql = $table->select()->where('numdep=?', $q);
$result = $table->fetchAll($sql); $result = $table->fetchAll($sql);
foreach ($result as $item) { foreach ($result as $item) {
@ -189,7 +189,7 @@ class FieldsController extends Zend_Controller_Action
} }
//Code Postal //Code Postal
$table = new Application_Model_CodePostaux(); $table = new Application_Model_CiblageCodePostaux();
$sql = $table->select()->where('Codepos LIKE "'.$q.'%"'); $sql = $table->select()->where('Codepos LIKE "'.$q.'%"');
$result = $table->fetchAll($sql); $result = $table->fetchAll($sql);
foreach ($result as $item) { foreach ($result as $item) {
@ -203,7 +203,7 @@ class FieldsController extends Zend_Controller_Action
break; break;
case 'cj': case 'cj':
$table = new Application_Model_FormeJuridique(); $table = new Application_Model_CiblageFormeJuridique();
$separator = ' , '; $separator = ' , ';
$sql = $table->select(); $sql = $table->select();

View File

@ -1,6 +1,8 @@
<?php <?php
class GestionController extends Zend_Controller_Action class GestionController extends Zend_Controller_Action
{ {
protected $dbMetier;
public function preDispatch() public function preDispatch()
{ {
@ -10,6 +12,14 @@ class GestionController extends Zend_Controller_Action
{ {
$this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all'); $this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all');
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript'); $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', ''); $login = $request->getParam('login', '');
$idClient = $request->getParam('idClient', null); $idClient = $request->getParam('idClient', null);
$profilsM = new Application_Model_EnrichissementProfils(); $profilsM = new Application_Model_CiblageEnrichissementProfils();
$sql = $profilsM->select() $sql = $profilsM->select()
->from($profilsM, array('id', 'idClient', 'login', 'reference', 'tarifLigne', 'dateAjout', 'dateSuppr', 'actif')); ->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); $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); $this->view->assign('profils', $profils);
} }
@ -66,7 +86,7 @@ class GestionController extends Zend_Controller_Action
if ($params['reference']=='default') { if ($params['reference']=='default') {
//Get default profil //Get default profil
$profilClientM = new Application_Model_CustomerParams(); $profilClientM = new Application_Model_CiblageCustomerParams();
$sql = $profilClientM->select()->where('idClient=?',$request->getParam('idClient')); $sql = $profilClientM->select()->where('idClient=?',$request->getParam('idClient'));
$profilClient = $profilClientM->fetchRow($sql); $profilClient = $profilClientM->fetchRow($sql);
if ( null !== $profilClient ) { if ( null !== $profilClient ) {
@ -90,7 +110,7 @@ class GestionController extends Zend_Controller_Action
'dateAjout' => date('Y-m-d H:i:s'), 'dateAjout' => date('Y-m-d H:i:s'),
'actif' => 1, 'actif' => 1,
); );
$profilM = new Application_Model_EnrichissementProfils(); $profilM = new Application_Model_CiblageEnrichissementProfils();
if ( $profilM->insert($data) ) { if ( $profilM->insert($data) ) {
$this->view->assign('message', "Profil enregistré"); $this->view->assign('message', "Profil enregistré");
$this->view->assign('disableForm', true); $this->view->assign('disableForm', true);
@ -130,7 +150,7 @@ class GestionController extends Zend_Controller_Action
$this->view->assign('month', $month); $this->view->assign('month', $month);
$this->view->assign('year', $year); $this->view->assign('year', $year);
$commandesM = new Application_Model_EnrichissementIdentifiants(); $commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
$sql = $commandesM->select()->setIntegrityCheck(false) $sql = $commandesM->select()->setIntegrityCheck(false)
->from('enrichissement_identifiants AS e', array( ->from('enrichissement_identifiants AS e', array(
'e.id', 'e.id',
@ -165,7 +185,7 @@ class GestionController extends Zend_Controller_Action
$this->view->assign('month', $month); $this->view->assign('month', $month);
$this->view->assign('year', $year); $this->view->assign('year', $year);
$commandesM = new Application_Model_EnrichissementIdentifiants(); $commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
$sql = $commandesM->select()->setIntegrityCheck(false) $sql = $commandesM->select()->setIntegrityCheck(false)
->from('enrichissement_identifiants AS e', array( ->from('enrichissement_identifiants AS e', array(
'e.id', 'e.id',
@ -204,7 +224,7 @@ class GestionController extends Zend_Controller_Action
public function extractAction() public function extractAction()
{ {
$id = $this->getRequest()->getParam('id'); $id = $this->getRequest()->getParam('id');
$table = new Application_Model_EnrichissementIdentifiants(); $table = new Application_Model_CiblageEnrichissementIdentifiants();
$sql = $table->select()->where('idComptage = ?', $id); $sql = $table->select()->where('idComptage = ?', $id);
$result = $table->fetchRow($sql); $result = $table->fetchRow($sql);
if(!empty($result)) { if(!empty($result)) {
@ -234,7 +254,7 @@ class GestionController extends Zend_Controller_Action
$this->view->assign('month', $month); $this->view->assign('month', $month);
$this->view->assign('year', $year); $this->view->assign('year', $year);
$comptagesM = new Application_Model_Comptages(); $comptagesM = new Application_Model_CiblageComptages();
$sql = $comptagesM->select()->setIntegrityCheck(false) $sql = $comptagesM->select()->setIntegrityCheck(false)
->from('ciblage_comptages', array( ->from('ciblage_comptages', array(
@ -266,7 +286,7 @@ class GestionController extends Zend_Controller_Action
$id = $request->getParam('id'); $id = $request->getParam('id');
//Lecture des paramètres du ciblage //Lecture des paramètres du ciblage
$criteresM = new Application_Model_Criteres(); $criteresM = new Application_Model_CiblageCriteres();
$sql = $criteresM->select() $sql = $criteresM->select()
->where('id = ?', $id); ->where('id = ?', $id);
$criteres = $criteresM->fetchRow($sql)->toArray(); $criteres = $criteresM->fetchRow($sql)->toArray();
@ -298,7 +318,7 @@ class GestionController extends Zend_Controller_Action
public function customerparamsAction() public function customerparamsAction()
{ {
//@todo : what's in database //@todo : what's in database
$customersM = new Application_Model_CustomerParams(); $customersM = new Application_Model_CiblageCustomerParams();
$sql = $customersM->select() $sql = $customersM->select()
->from($customersM,array('idClient', 'service' , 'dateContrat', 'periodContrat')) ->from($customersM,array('idClient', 'service' , 'dateContrat', 'periodContrat'))
->order('dateAdded DESC') ->order('dateAdded DESC')
@ -307,7 +327,8 @@ class GestionController extends Zend_Controller_Action
//List login //List login
$customerlist = array(); $customerlist = array();
$profilsM = new Application_Model_EnrichissementProfils(); $profilsM = new Application_Model_CiblageEnrichissementProfils();
$clientM = new Application_Model_Sdv1Clients();
foreach($customers as $item) { foreach($customers as $item) {
$sql = $profilsM->select() $sql = $profilsM->select()
->from($profilsM, array('login')) ->from($profilsM, array('login'))
@ -320,8 +341,12 @@ class GestionController extends Zend_Controller_Action
$logins[] = $login['login']; $logins[] = $login['login'];
} }
} }
$item['logins'] = $logins; $item['logins'] = $logins;
$sql = $clientM->select()->where('id=?', $item['idClient']);
$result = $clientM->fetchRow($sql);
$item['nom'] = $result->nom;
$customerlist[] = $item; $customerlist[] = $item;
} }
$this->view->assign('customerlist', $customerlist); $this->view->assign('customerlist', $customerlist);
@ -344,17 +369,23 @@ class GestionController extends Zend_Controller_Action
$this->view->assign('idClient', $idClient); $this->view->assign('idClient', $idClient);
if ($idClient !== null) { if ($idClient !== null) {
$paramsM = new Application_Model_CustomerParams(); $paramsM = new Application_Model_CiblageCustomerParams();
$sql = $paramsM->select()->where('idClient = ?', $idClient); $sql = $paramsM->select()->where('idClient = ?', $idClient);
$params = $paramsM->fetchRow($sql); $params = $paramsM->fetchRow($sql);
$infos = null; $infos = null;
if ($params!==null){ if ($params!==null){
$infos = $params->toArray(); $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); $infos['criteres'] = json_decode($infos['criteres'], true);
} }
$this->view->assign('infos',$infos); $this->view->assign('infos',$infos);
$loginsM = new Application_Model_EnrichissementProfils(); $loginsM = new Application_Model_CiblageEnrichissementProfils();
$sql = $loginsM->select()->where('idClient = ?', $idClient); $sql = $loginsM->select()->where('idClient = ?', $idClient);
$logins = $loginsM->fetchAll($sql)->toArray(); $logins = $loginsM->fetchAll($sql)->toArray();
$this->view->assign('logins', $logins); $this->view->assign('logins', $logins);
@ -416,7 +447,7 @@ class GestionController extends Zend_Controller_Action
if ($request->getParam('submit')=='Modifier') { if ($request->getParam('submit')=='Modifier') {
//Overwrite default profil for each login //Overwrite default profil for each login
try { try {
$profilM = new Application_Model_EnrichissementProfils(); $profilM = new Application_Model_CiblageEnrichissementProfils();
$profilM->update(array( $profilM->update(array(
'criteres' => json_encode($params['criteres']) 'criteres' => json_encode($params['criteres'])
), "reference='default' AND idClient=".$params['idClient']); ), "reference='default' AND idClient=".$params['idClient']);
@ -426,7 +457,7 @@ class GestionController extends Zend_Controller_Action
//Set parameters //Set parameters
try { try {
$customerParamsM = new Application_Model_CustomerParams(); $customerParamsM = new Application_Model_CiblageCustomerParams();
$customerParamsM->update($data, 'id='.$params['id']); $customerParamsM->update($data, 'id='.$params['id']);
$this->view->assign('message', "Profil enregistré"); $this->view->assign('message', "Profil enregistré");
} catch ( Zend_Db_Adapter_Exception $e) { } catch ( Zend_Db_Adapter_Exception $e) {
@ -436,7 +467,7 @@ class GestionController extends Zend_Controller_Action
} else { } else {
//Set parameters //Set parameters
$customerParamsM = new Application_Model_CustomerParams(); $customerParamsM = new Application_Model_CiblageCustomerParams();
if ( $customerParamsM->insert($data) ){ if ( $customerParamsM->insert($data) ){
$this->view->assign('message', "Profil enregistré"); $this->view->assign('message', "Profil enregistré");
} else { } else {
@ -451,8 +482,13 @@ class GestionController extends Zend_Controller_Action
$idClient = $request->getParam('idClient', null); $idClient = $request->getParam('idClient', null);
$clientM = new Application_Model_Sdv1Clients();
$sql = $clientM->select()->where('actif=?',1);
$selectClient = $clientM->fetchAll($sql);
$this->view->assign('selectClient',$selectClient);
if ($idClient !== null) { if ($idClient !== null) {
$paramsM = new Application_Model_CustomerParams(); $paramsM = new Application_Model_CiblageCustomerParams();
$sql = $paramsM->select()->where('idClient = ?', $idClient); $sql = $paramsM->select()->where('idClient = ?', $idClient);
$params = $paramsM->fetchRow($sql); $params = $paramsM->fetchRow($sql);
if ( $params!==null ) { if ( $params!==null ) {

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_CiblageCodePostaux extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_codepostaux';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_CiblageComptages extends Zend_Db_Table_Abstract
{
protected $_name = 'ciblage_comptages';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_CiblageCriteres extends Zend_Db_Table_Abstract
{
protected $_name = 'ciblage_criteres';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_CiblageCustomerParams extends Zend_Db_Table_Abstract
{
protected $_name = 'customer_params';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_CiblageDepartements extends Zend_Db_Table_Abstract
{
public $_name = 'fields_departements';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_CiblageEnrichissementIdentifiants extends Zend_Db_Table_Abstract
{
public $_name = 'enrichissement_identifiants';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_CiblageEnrichissementProfils extends Zend_Db_Table_Abstract
{
public $_name = 'enrichissement_profils';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,7 @@
<?php
class Application_Model_CiblageFormeJuridique extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_formejuridique';
protected $_primary = 'fjCode';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_CiblageMinMax extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_minmax';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_CiblageNaf extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_naf';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_CiblagePrefs extends Zend_Db_Table_Abstract
{
protected $_name = 'customer_prefs';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,7 @@
<?php
class Application_Model_CiblageRegions extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_regions';
protected $_schema = 'ciblage';
}

View File

@ -1,5 +0,0 @@
<?php
class Application_Model_CodePostaux extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_codepostaux';
}

View File

@ -1,5 +0,0 @@
<?php
class Application_Model_Comptages extends Zend_Db_Table_Abstract
{
protected $_name = 'ciblage_comptages';
}

View File

@ -1,5 +0,0 @@
<?php
class Application_Model_Criteres extends Zend_Db_Table_Abstract
{
protected $_name = 'ciblage_criteres';
}

View File

@ -1,5 +0,0 @@
<?php
class Application_Model_CustomerParams extends Zend_Db_Table_Abstract
{
protected $_name = 'customer_params';
}

View File

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

View File

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

View File

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

View File

@ -1,7 +0,0 @@
<?php
class Application_Model_FormeJuridique extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_formejuridique';
protected $_primary = 'fjCode';
}

View File

@ -2,4 +2,5 @@
class Application_Model_JoSpinxIdx extends Zend_Db_Table_Abstract class Application_Model_JoSpinxIdx extends Zend_Db_Table_Abstract
{ {
protected $_name = 'sphinx_idx'; protected $_name = 'sphinx_idx';
protected $_schema = 'jo';
} }

View File

@ -1,5 +0,0 @@
<?php
class Application_Model_MinMax extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_minmax';
}

View File

@ -1,5 +0,0 @@
<?php
class Application_Model_Naf extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_naf';
}

View File

@ -1,5 +0,0 @@
<?php
class Application_Model_Prefs extends Zend_Db_Table_Abstract
{
protected $_name = 'customer_prefs';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_Regions extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_regions';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_Sdv1Clients extends Zend_Db_Table_Abstract
{
protected $_name = 'clients';
protected $_schema = 'sdv1';
}

View File

@ -0,0 +1,13 @@
<?php
class Application_Model_Sdv1Utilisateurs extends Zend_Db_Table_Abstract
{
protected $_name = 'utilisateurs';
protected $_schema = 'sdv1';
protected $_referenceMap = array(
'Reporter' => array(
'columns' => 'idClient',
'refTableClass' => 'Sdv1Clients',
'refColumns' => 'id'
),
);
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_Sdv1UtilisateursService extends Zend_Db_Table_Abstract
{
protected $_name = 'utilisateurs_service';
protected $_schema = 'sdv1';
}

View File

@ -2,7 +2,7 @@
<h2>Paramètres client</h2> <h2>Paramètres client</h2>
<table> <table>
<tr><td>idClient</td><td><?=$this->infos['idClient']?></td></tr> <tr><td>Nom</td><td><?=$this->infos['nom']?></td></tr>
<tr><td>service</td><td><?=$this->infos['service']?></td></tr> <tr><td>service</td><td><?=$this->infos['service']?></td></tr>
<tr><td>filterRNCS</td><td><?=$this->infos['filterRNCS']?></td></tr> <tr><td>filterRNCS</td><td><?=$this->infos['filterRNCS']?></td></tr>
<tr><td>licenceINSEE</td><td><?=$this->infos['licenceINSEE']?></td></tr> <tr><td>licenceINSEE</td><td><?=$this->infos['licenceINSEE']?></td></tr>

View File

@ -13,8 +13,13 @@
<?php }?> <?php }?>
<div> <div>
<label>idClient</label> <label>Client</label>
<input type="text" name="idClient" value="<?=$this->idClient?>"/> <select name="idClient">
<?php foreach ( $this->selectClient as $client ) {?>
<?php $select = ''; if ($this->idClient==$client->id) { $select = ' selected'; }?>
<option value="<?=$client->id?>"<?=$select?>><?=$client->nom?></option>
<?php }?>
</select>
</div> </div>
<div> <div>

View File

@ -8,7 +8,7 @@
<div class="paragraph"> <div class="paragraph">
<table> <table>
<tr> <tr>
<th>idClient</th> <th>Nom</th>
<th>Début du contrat</th> <th>Début du contrat</th>
<th>Durée contrat</th> <th>Durée contrat</th>
<th>Logins ouvert</th> <th>Logins ouvert</th>
@ -16,7 +16,7 @@
</tr> </tr>
<?php foreach($this->customerlist as $item) {?> <?php foreach($this->customerlist as $item) {?>
<tr> <tr>
<td><?=$item['idClient']?></td> <td><?=$item['nom']?></td>
<td><?=$item['dateContrat']?></td> <td><?=$item['dateContrat']?></td>
<td><?=$item['periodContrat']?></td> <td><?=$item['periodContrat']?></td>
<td> <td>

View File

@ -12,7 +12,7 @@ IdClient : <input type="text" name="idClient" /> - Login : <input type="text" n
<table> <table>
<thead> <thead>
<tr> <tr>
<th>idClient</th> <th>Nom</th>
<th>login</th> <th>login</th>
<th>reference</th> <th>reference</th>
<th>tarifLigne</th> <th>tarifLigne</th>
@ -24,7 +24,7 @@ IdClient : <input type="text" name="idClient" /> - Login : <input type="text" n
<tbody> <tbody>
<?php foreach ( $this->profils as $profil ) {?> <?php foreach ( $this->profils as $profil ) {?>
<tr> <tr>
<td><?=$profil['idClient']?></td> <td><?=$profil['nom']?></td>
<td><?=$profil['login']?></td> <td><?=$profil['login']?></td>
<td><?=$profil['reference']?></td> <td><?=$profil['reference']?></td>
<td><?=$profil['tarifLigne']?></td> <td><?=$profil['tarifLigne']?></td>

View File

@ -67,7 +67,7 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
if ( !isset($identity->dateContrat) && $layout->isEnabled() ) if ( !isset($identity->dateContrat) && $layout->isEnabled() )
{ {
//Get customer's params //Get customer's params
$paramsM = new Application_Model_CustomerParams(); $paramsM = new Application_Model_CiblageCustomerParams();
$sql = $paramsM->select() $sql = $paramsM->select()
->where('idClient = ?', $identity->idClient) ->where('idClient = ?', $identity->idClient)
//@todo : add service from WebService //@todo : add service from WebService
@ -88,7 +88,7 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
} }
//Get user's preference //Get user's preference
$prefsM = new Application_Model_Prefs(); $prefsM = new Application_Model_CiblagePrefs();
$pref = $prefsM->find($identity->username)->current(); $pref = $prefsM->find($identity->username)->current();
if ($pref) { if ($pref) {
$identity->preferences = json_decode($pref->json, true); $identity->preferences = json_decode($pref->json, true);

View File

@ -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 // Chargement des critères de ciblage à partir de l'enregistrement en bdd
$id = $request->getParam('id', 0); $id = $request->getParam('id', 0);
if (!empty($id)) { if (!empty($id)) {
$criteresM = new Application_Model_Criteres(); $criteresM = new Application_Model_CiblageCriteres();
$sql = $criteresM->select() $sql = $criteresM->select()
->from($criteresM, array('criteres')) ->from($criteresM, array('criteres'))
->where('login = ?', $user->username) ->where('login = ?', $user->username)

View File

@ -240,7 +240,7 @@ class Ciblage
protected function minmax($key, $min=null, $max=null) protected function minmax($key, $min=null, $max=null)
{ {
//Read min max //Read min max
$minmaxM = new Application_Model_MinMax(); $minmaxM = new Application_Model_CiblageMinMax();
$minmax = $minmaxM->find($key)->current(); $minmax = $minmaxM->find($key)->current();
if ($minmax!==false) { if ($minmax!==false) {
@ -864,7 +864,7 @@ class Ciblage
$lastLevel = array(); $lastLevel = array();
if ( count($list)>0 ) { if ( count($list)>0 ) {
$nafM = new Application_Model_Naf(); $nafM = new Application_Model_CiblageNaf();
foreach ( $list as $item ) { foreach ( $list as $item ) {
@ -984,7 +984,7 @@ class Ciblage
break; break;
case 'R': case 'R':
$departementsM = new Application_Model_Departements(); $departementsM = new Application_Model_CiblageDepartements();
$sql = $departementsM->select() $sql = $departementsM->select()
->from($departementsM, array('numdep')) ->from($departementsM, array('numdep'))
->where('codeRegionInsee = ?', substr($item,1)); ->where('codeRegionInsee = ?', substr($item,1));
@ -1009,7 +1009,7 @@ class Ciblage
break; break;
case 'R': case 'R':
$departementsM = new Application_Model_Departements(); $departementsM = new Application_Model_CiblageDepartements();
$sql = $departementsM->select() $sql = $departementsM->select()
->from($departementsM, array('numdep')) ->from($departementsM, array('numdep'))
->where('codeRegionInsee = ?', substr($item,1)); ->where('codeRegionInsee = ?', substr($item,1));
@ -1034,7 +1034,7 @@ class Ciblage
//Check if a departement include a codeCommune else remove this codeCommune //Check if a departement include a codeCommune else remove this codeCommune
if (count($departementValueIn)>0) { if (count($departementValueIn)>0) {
foreach ( $departementValueIn as $item ) { foreach ( $departementValueIn as $item ) {
$codePostauxM = new Application_Model_CodePostaux(); $codePostauxM = new Application_Model_CiblageCodePostaux();
$sql = $codePostauxM->select() $sql = $codePostauxM->select()
->from($codePostauxM, array('INSEE')) ->from($codePostauxM, array('INSEE'))
->where('Codepos LIKE ?', $item.'%'); ->where('Codepos LIKE ?', $item.'%');
@ -1055,7 +1055,7 @@ class Ciblage
//Check if a departement include a codeCommune else remove this codeCommune //Check if a departement include a codeCommune else remove this codeCommune
if (count($departementValueEx)>0) { if (count($departementValueEx)>0) {
foreach ( $departementValueEx as $item ) { foreach ( $departementValueEx as $item ) {
$codePostauxM = new Application_Model_CodePostaux(); $codePostauxM = new Application_Model_CiblageCodePostaux();
$sql = $codePostauxM->select() $sql = $codePostauxM->select()
->from($codePostauxM, array('INSEE')) ->from($codePostauxM, array('INSEE'))
->where('Codepos LIKE ?', $item.'%'); ->where('Codepos LIKE ?', $item.'%');
@ -1105,7 +1105,7 @@ class Ciblage
$childItem = array(); $childItem = array();
$result = array(); $result = array();
$fjM = new Application_Model_FormeJuridique(); $fjM = new Application_Model_CiblageFormeJuridique();
//Only code with a length between 1 and 3 //Only code with a length between 1 and 3
if ( strlen($item)<4 ) { if ( strlen($item)<4 ) {

View File

@ -28,7 +28,7 @@ class Enrichissement
'raisonSociale' => array(), //Raison Sociale 'raisonSociale' => array(), //Raison Sociale
'enseigne' => array(), //Enseigne 'enseigne' => array(), //Enseigne
'sigle' => array(), //Sigle 'sigle' => array(), //Sigle
'identite_pre' => array(), 'identite_pre' => array(), //Identite Précédente
'marques' => array(), 'marques' => array(),
'adr_num' => array(), //Adresse 'adr_num' => array(), //Adresse
'adr_btq' => array(), //Adresse 'adr_btq' => array(), //Adresse

View File

@ -896,7 +896,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
break; break;
case 'interval': case 'interval':
//Read min max //Read min max
$minmaxM = new Application_Model_MinMax(); $minmaxM = new Application_Model_CiblageMinMax();
$minmax = $minmaxM->find($sessionKey)->current(); $minmax = $minmaxM->find($sessionKey)->current();
if ($minmax!==false) { if ($minmax!==false) {
$valMin = $minmax->min; $valMin = $minmax->min;
@ -1069,7 +1069,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
*/ */
protected function getMinMax($name) protected function getMinMax($name)
{ {
$MinMaxM = new Application_Model_MinMax(); $MinMaxM = new Application_Model_CiblageMinMax();
$minmax = $MinMaxM->fetchAll($MinMaxM->select()->where('cle = ?', $name))->toArray(); $minmax = $MinMaxM->fetchAll($MinMaxM->select()->where('cle = ?', $name))->toArray();
return $minmax; 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); $values = array_map(function($value){ return '"'.$value.'"'; }, $values);
$out = array(); $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).')'); $sql = $nafM->select()->from($nafM, array('lib', 'code'))->where('code IN ('.join(',',$values).')');
$result = $nafM->fetchAll($sql)->toArray(); $result = $nafM->fetchAll($sql)->toArray();
foreach ( $result as $elem ) { 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 ) { foreach ( $values as $item ) {
switch( substr($item,0,1) ) { switch( substr($item,0,1) ) {
case 'C': case 'C':
$communeM = new Application_Model_CodePostaux(); $communeM = new Application_Model_CiblageCodePostaux();
$sql = $communeM->select()->from($communeM, array('Commune', 'Codepos')) $sql = $communeM->select()->from($communeM, array('Commune', 'Codepos'))
->where('INSEE = ?', substr($item, 1)); ->where('INSEE = ?', substr($item, 1));
$result = $communeM->fetchAll($sql)->toArray(); $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'].')'; $out[] = $result[0]['Commune'].' ('.$result[0]['Codepos'].')';
break; break;
case 'D': case 'D':
$departementsM = new Application_Model_Departements(); $departementsM = new Application_Model_CiblageDepartements();
$sql = $departementsM->select()->from($departementsM, array('libdep', 'numdep')) $sql = $departementsM->select()->from($departementsM, array('libdep', 'numdep'))
->where('numdep = ?', substr($item, 1)); ->where('numdep = ?', substr($item, 1));
$result = $departementsM->fetchAll($sql)->toArray(); $result = $departementsM->fetchAll($sql)->toArray();
$out[] = $result[0]['libdep'].' ('.$result[0]['numdep'].')'; $out[] = $result[0]['libdep'].' ('.$result[0]['numdep'].')';
break; break;
case 'R': case 'R':
$regionsM = new Application_Model_Regions(); $regionsM = new Application_Model_CiblageRegions();
$sql = $regionsM->select()->from($regionsM, array('NCCENR'))->where('REGION = ?', substr($item,1)); $sql = $regionsM->select()->from($regionsM, array('NCCENR'))->where('REGION = ?', substr($item,1));
$result = $regionsM->fetchAll($sql)->toArray(); $result = $regionsM->fetchAll($sql)->toArray();
$out[] = $result[0]['NCCENR']; $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) public function getValueLabelCodespostaux($values)
{ {
foreach ( $values as $item ) { foreach ( $values as $item ) {
$communeM = new Application_Model_CodePostaux(); $communeM = new Application_Model_CiblageCodePostaux();
$sql = $communeM->select()->from($communeM, array('Commune'))->where('Codepos = ?', $item); $sql = $communeM->select()->from($communeM, array('Commune'))->where('Codepos = ?', $item);
$result = $communeM->fetchAll($sql)->toArray(); $result = $communeM->fetchAll($sql)->toArray();
$strCommunes = ''; $strCommunes = '';
@ -1172,7 +1172,7 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
public function getValueLabelCodesdepts($values) public function getValueLabelCodesdepts($values)
{ {
foreach ( $values as $item ) { foreach ( $values as $item ) {
$departementsM = new Application_Model_Departements(); $departementsM = new Application_Model_CiblageDepartements();
$sql = $departementsM->select()->from($departementsM, array('libdep'))->where('numdep = ?', $item); $sql = $departementsM->select()->from($departementsM, array('libdep'))->where('numdep = ?', $item);
$result = $departementsM->fetchAll($sql)->toArray(); $result = $departementsM->fetchAll($sql)->toArray();
$out[] = $item.' ('.$result[0]['libdep'].')'; $out[] = $item.' ('.$result[0]['libdep'].')';
@ -1180,10 +1180,10 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
return $out; return $out;
} }
public function getValueLabelCodeinsee($values) public function getValueLabelCodesinsee($values)
{ {
foreach ( $values as $item ) { foreach ( $values as $item ) {
$communeM = new Application_Model_CodePostaux(); $communeM = new Application_Model_CiblageCodePostaux();
$sql = $communeM->select()->from($communeM, array('Commune'))->where('INSEE = ?', $item); $sql = $communeM->select()->from($communeM, array('Commune'))->where('INSEE = ?', $item);
$result = $communeM->fetchAll($sql)->toArray(); $result = $communeM->fetchAll($sql)->toArray();
$out[] = $item.' ('.$result[0]['Commune'].')'; $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); $values = array_map(function($value){ return '"'.$value.'"'; }, $values);
$out = array(); $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).')'); $sql = $fjM->select()->from($fjM, array('fjLibelle', 'fjCode'))->where('fjCode IN ('.join(',',$values).')');
$result = $fjM->fetchAll($sql)->toArray(); $result = $fjM->fetchAll($sql)->toArray();
foreach ( $result as $elem ) { foreach ( $result as $elem ) {

View File

@ -1,21 +1,21 @@
[local] [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.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.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.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 webservices.exporter.options.soap_version = SOAP_1_2
[sdsrvdev01] [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.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.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.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 webservices.exporter.options.soap_version = SOAP_1_2
[sd-25137] [sd-25137]

View File

@ -438,10 +438,6 @@ ul#fieldsblock li div.fieldgrp div.field .interval input[type=text] {
text-decoration: none; text-decoration: none;
} }
#dialogcritere ul li {
line-height:16px;
}
#dialogcritere a.remove { #dialogcritere a.remove {
margin:0; margin:0;
padding:0; padding:0;

View File

@ -31,19 +31,14 @@ profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.mail.email.contact = supportdev@scores-decisions.com profil.mail.email.contact = supportdev@scores-decisions.com
profil.mail.email.production = supportdev@scores-decisions.com profil.mail.email.production = supportdev@scores-decisions.com
profil.path.data = "/home/vhosts/data" profil.path.data = "/home/vhosts/data"
profil.db.ciblage.adapter=mysqli
profil.db.ciblage.params.host=127.0.0.1 profil.db.metier.adapter=mysqli
profil.db.ciblage.params.username=ciblage profil.db.metier.params.host=192.168.3.30
profil.db.ciblage.params.password=z7jq8AhvrwqQJ4Yb profil.db.metier.params.username=ciblage
profil.db.ciblage.params.dbname=ciblage profil.db.metier.params.password=z7jq8AhvrwqQJ4Yb
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" profil.db.metier.params.dbname=jo
profil.db.jo.adapter=mysqli profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.db.jo.params.host=192.168.3.30
profil.db.jo.params.username=ciblage
profil.db.jo.params.password=z7jq8AhvrwqQJ4Yb
profil.db.jo.params.dbname=jo
profil.db.jo.params.persistent = true
profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.sphinx.host=127.0.0.1 profil.sphinx.host=127.0.0.1
profil.sphinx.port=3312 profil.sphinx.port=3312

View File

@ -23,27 +23,22 @@ autoloaderNamespaces[] = "Form_"
; Scores configuration ; Scores configuration
profil.server.name = development profil.server.name = development
profil.webservice.location = sdsrvdev01 profil.webservice.location = local
profil.mail.method = smtp profil.mail.method = smtp
profil.mail.smtp_host = smtp.free.fr profil.mail.smtp_host = smtp.free.fr
profil.mail.email.support = supportdev@scores-decisions.com profil.mail.email.support = supportdev@scores-decisions.com
profil.mail.email.supportdev = supportdev@scores-decisions.com profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.mail.email.contact = supportdev@scores-decisions.com profil.mail.email.contact = supportdev@scores-decisions.com
profil.mail.email.production = supportdev@scores-decisions.com profil.mail.email.production = supportdev@scores-decisions.com
profil.path.data = "d:\www\dataciblage" profil.path.data = "your/data/path
profil.db.ciblage.adapter=mysqli
profil.db.ciblage.params.host=127.0.0.1 profil.db.metier.adapter=mysqli
profil.db.ciblage.params.username=root profil.db.metier.params.host=192.168.78.230
profil.db.ciblage.params.password=bj10sx profil.db.metier.params.username=ciblage
profil.db.ciblage.params.dbname=ciblage profil.db.metier.params.password=z7jq8AhvrwqQJ4Yb
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" profil.db.metier.params.dbname=jo
profil.db.jo.adapter=mysqli profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.db.jo.params.host=192.168.78.230
profil.db.jo.params.username=ciblage
profil.db.jo.params.password=z7jq8AhvrwqQJ4Yb
profil.db.jo.params.dbname=jo
profil.db.jo.params.persistent = true
profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.sphinx.host=192.168.78.252 profil.sphinx.host=192.168.78.252
profil.sphinx.port=3312 profil.sphinx.port=3312

View File

@ -31,19 +31,14 @@ profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.mail.email.contact = supportdev@scores-decisions.com profil.mail.email.contact = supportdev@scores-decisions.com
profil.mail.email.production = supportdev@scores-decisions.com profil.mail.email.production = supportdev@scores-decisions.com
profil.path.data = "d:\www\dataciblage" profil.path.data = "d:\www\dataciblage"
profil.db.ciblage.adapter=mysqli
profil.db.ciblage.params.host=127.0.0.1 profil.db.metier.adapter=mysqli
profil.db.ciblage.params.username=root profil.db.metier.params.host=192.168.78.230
profil.db.ciblage.params.password=bj10sx profil.db.metier.params.username=ciblage
profil.db.ciblage.params.dbname=ciblage profil.db.metier.params.password=z7jq8AhvrwqQJ4Yb
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" profil.db.metier.params.dbname=jo
profil.db.jo.adapter=mysqli profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.db.jo.params.host=192.168.78.230
profil.db.jo.params.username=ciblage
profil.db.jo.params.password=z7jq8AhvrwqQJ4Yb
profil.db.jo.params.dbname=jo
profil.db.jo.params.persistent = true
profil.db.jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
profil.sphinx.host=192.168.78.252 profil.sphinx.host=192.168.78.252
profil.sphinx.port=3312 profil.sphinx.port=3312

View File

@ -43,9 +43,9 @@ if(isset($opts->help))
} }
$c = new Zend_Config($application->getOptions()); $c = new Zend_Config($application->getOptions());
$db = Zend_Db::factory($c->profil->db->ciblage); $db = Zend_Db::factory($c->profil->db->metier);
$commandesM = new Application_Model_EnrichissementIdentifiants($db); $commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
$sql = $commandesM->select() $sql = $commandesM->select()
->where('idProfil != ?', 0) ->where('idProfil != ?', 0)

View File

@ -56,13 +56,7 @@ Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
//Définition bdd //Définition bdd
try { try {
$db = Zend_Db::factory($config->profil->db->ciblage); $db = Zend_Db::factory($config->profil->db->metier);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
//Définition bdd metier
try {
$dbMetier = Zend_Db::factory($config->profil->db->jo);
} catch ( Exception $e ) { } catch ( Exception $e ) {
exit ( $e->getMessage() ); exit ( $e->getMessage() );
} }
@ -72,12 +66,12 @@ $liste = array();
if ($opts->id) if ($opts->id)
{ {
//Read SIRETs //Read SIRETs
$commandesM = new Application_Model_EnrichissementIdentifiants($db); $commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
$commande = $commandesM->find(intval($opts->id))->current(); $commande = $commandesM->find(intval($opts->id))->current();
$identifiants = json_decode($commande->identifiants, true); $identifiants = json_decode($commande->identifiants, true);
//Read profil for data extract //Read profil for data extract
$profilM = new Application_Model_EnrichissementProfils($db); $profilM = new Application_Model_CiblageEnrichissementProfils();
$profil = $profilM->find(intval($commande->idProfil))->current(); $profil = $profilM->find(intval($commande->idProfil))->current();
$dataProfil = json_decode($profil->criteres, true); $dataProfil = json_decode($profil->criteres, true);
} }

View File

@ -45,13 +45,7 @@ if(isset($opts->help))
$config = new Zend_Config($application->getOptions()); $config = new Zend_Config($application->getOptions());
try { try {
$db = Zend_Db::factory($config->profil->db->ciblage); $db = Zend_Db::factory($config->profil->db->metier);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
//Définition bdd metier
try {
$dbMetier = Zend_Db::factory($config->profil->db->jo);
} catch ( Exception $e ) { } catch ( Exception $e ) {
exit ( $e->getMessage() ); exit ( $e->getMessage() );
} }
@ -85,7 +79,7 @@ $keys = array(
'bilYP', 'bilYP',
); );
$sql = 'TRUNCATE TABLE fields_minmax'; $sql = 'TRUNCATE TABLE ciblage.fields_minmax';
if ( !$db->query($sql) ) { if ( !$db->query($sql) ) {
die ('Impossible de vider la table fields_minmax'); die ('Impossible de vider la table fields_minmax');
} }
@ -93,7 +87,7 @@ if ( !$db->query($sql) ) {
foreach($keys as $key) { foreach($keys as $key) {
//Lecture //Lecture
$sql = 'SELECT MIN('.$key.') AS min, MAX('.$key.') AS max FROM etablissements_act'; $sql = 'SELECT MIN('.$key.') AS min, MAX('.$key.') AS max FROM jo.etablissements_act';
$stmt = $dbMetier->query($sql); $stmt = $dbMetier->query($sql);
$result = $stmt->fetchObject(); $result = $stmt->fetchObject();
@ -103,7 +97,7 @@ foreach($keys as $key) {
'min' => $result->min, 'min' => $result->min,
'max' => $result->max, 'max' => $result->max,
); );
$db->insert('fields_minmax', $data); $db->insert('ciblage.fields_minmax', $data);
if ($opts->manuel) echo $key.' -> min:'.$result->min.' max:'.$result->max."\n"; if ($opts->manuel) echo $key.' -> min:'.$result->min.' max:'.$result->max."\n";
} }
if ($opts->manuel) print("Terminé\n"); if ($opts->manuel) print("Terminé\n");