Merge Branch 1.3 - Main update is the move of database
This commit is contained in:
commit
e14e96610a
@ -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
|
||||
*/
|
||||
|
@ -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);
|
||||
|
@ -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')
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
class GestionController extends Zend_Controller_Action
|
||||
{
|
||||
public function preDispatch()
|
||||
protected $dbMetier;
|
||||
|
||||
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->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 {
|
||||
@ -451,8 +482,13 @@ class GestionController extends Zend_Controller_Action
|
||||
|
||||
$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) {
|
||||
$paramsM = new Application_Model_CustomerParams();
|
||||
$paramsM = new Application_Model_CiblageCustomerParams();
|
||||
$sql = $paramsM->select()->where('idClient = ?', $idClient);
|
||||
$params = $paramsM->fetchRow($sql);
|
||||
if ( $params!==null ) {
|
||||
|
6
application/models/CiblageCodePostaux.php
Normal file
6
application/models/CiblageCodePostaux.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_CiblageCodePostaux extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_codepostaux';
|
||||
protected $_schema = 'ciblage';
|
||||
}
|
6
application/models/CiblageComptages.php
Normal file
6
application/models/CiblageComptages.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_CiblageComptages extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'ciblage_comptages';
|
||||
protected $_schema = 'ciblage';
|
||||
}
|
6
application/models/CiblageCriteres.php
Normal file
6
application/models/CiblageCriteres.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_CiblageCriteres extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'ciblage_criteres';
|
||||
protected $_schema = 'ciblage';
|
||||
}
|
6
application/models/CiblageCustomerParams.php
Normal file
6
application/models/CiblageCustomerParams.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_CiblageCustomerParams extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'customer_params';
|
||||
protected $_schema = 'ciblage';
|
||||
}
|
6
application/models/CiblageDepartements.php
Normal file
6
application/models/CiblageDepartements.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_CiblageDepartements extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'fields_departements';
|
||||
protected $_schema = 'ciblage';
|
||||
}
|
6
application/models/CiblageEnrichissementIdentifiants.php
Normal file
6
application/models/CiblageEnrichissementIdentifiants.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_CiblageEnrichissementIdentifiants extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'enrichissement_identifiants';
|
||||
protected $_schema = 'ciblage';
|
||||
}
|
6
application/models/CiblageEnrichissementProfils.php
Normal file
6
application/models/CiblageEnrichissementProfils.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_CiblageEnrichissementProfils extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'enrichissement_profils';
|
||||
protected $_schema = 'ciblage';
|
||||
}
|
7
application/models/CiblageFormeJuridique.php
Normal file
7
application/models/CiblageFormeJuridique.php
Normal 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';
|
||||
}
|
6
application/models/CiblageMinMax.php
Normal file
6
application/models/CiblageMinMax.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_CiblageMinMax extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_minmax';
|
||||
protected $_schema = 'ciblage';
|
||||
}
|
6
application/models/CiblageNaf.php
Normal file
6
application/models/CiblageNaf.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_CiblageNaf extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_naf';
|
||||
protected $_schema = 'ciblage';
|
||||
}
|
6
application/models/CiblagePrefs.php
Normal file
6
application/models/CiblagePrefs.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_CiblagePrefs extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'customer_prefs';
|
||||
protected $_schema = 'ciblage';
|
||||
}
|
7
application/models/CiblageRegions.php
Normal file
7
application/models/CiblageRegions.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
class Application_Model_CiblageRegions extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_regions';
|
||||
protected $_schema = 'ciblage';
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_CodePostaux extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_codepostaux';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_Comptages extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'ciblage_comptages';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_Criteres extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'ciblage_criteres';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_CustomerParams extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'customer_params';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_Departements extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'fields_departements';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_EnrichissementIdentifiants extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'enrichissement_identifiants';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_EnrichissementProfils extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'enrichissement_profils';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_FormeJuridique extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_formejuridique';
|
||||
protected $_primary = 'fjCode';
|
||||
|
||||
}
|
@ -2,4 +2,5 @@
|
||||
class Application_Model_JoSpinxIdx extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'sphinx_idx';
|
||||
protected $_schema = 'jo';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_MinMax extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_minmax';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_Naf extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_naf';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_Prefs extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'customer_prefs';
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_Regions extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_regions';
|
||||
}
|
||||
|
6
application/models/Sdv1Clients.php
Normal file
6
application/models/Sdv1Clients.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_Sdv1Clients extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'clients';
|
||||
protected $_schema = 'sdv1';
|
||||
}
|
13
application/models/Sdv1Utilisateurs.php
Normal file
13
application/models/Sdv1Utilisateurs.php
Normal 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'
|
||||
),
|
||||
);
|
||||
}
|
6
application/models/Sdv1UtilisateursService.php
Normal file
6
application/models/Sdv1UtilisateursService.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_Sdv1UtilisateursService extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'utilisateurs_service';
|
||||
protected $_schema = 'sdv1';
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
<h2>Paramètres client</h2>
|
||||
|
||||
<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>filterRNCS</td><td><?=$this->infos['filterRNCS']?></td></tr>
|
||||
<tr><td>licenceINSEE</td><td><?=$this->infos['licenceINSEE']?></td></tr>
|
||||
|
@ -13,8 +13,13 @@
|
||||
<?php }?>
|
||||
|
||||
<div>
|
||||
<label>idClient</label>
|
||||
<input type="text" name="idClient" value="<?=$this->idClient?>"/>
|
||||
<label>Client</label>
|
||||
<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>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<div class="paragraph">
|
||||
<table>
|
||||
<tr>
|
||||
<th>idClient</th>
|
||||
<th>Nom</th>
|
||||
<th>Début du contrat</th>
|
||||
<th>Durée contrat</th>
|
||||
<th>Logins ouvert</th>
|
||||
@ -16,7 +16,7 @@
|
||||
</tr>
|
||||
<?php foreach($this->customerlist as $item) {?>
|
||||
<tr>
|
||||
<td><?=$item['idClient']?></td>
|
||||
<td><?=$item['nom']?></td>
|
||||
<td><?=$item['dateContrat']?></td>
|
||||
<td><?=$item['periodContrat']?></td>
|
||||
<td>
|
||||
|
@ -12,7 +12,7 @@ IdClient : <input type="text" name="idClient" /> - Login : <input type="text" n
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>idClient</th>
|
||||
<th>Nom</th>
|
||||
<th>login</th>
|
||||
<th>reference</th>
|
||||
<th>tarifLigne</th>
|
||||
@ -24,7 +24,7 @@ IdClient : <input type="text" name="idClient" /> - Login : <input type="text" n
|
||||
<tbody>
|
||||
<?php foreach ( $this->profils as $profil ) {?>
|
||||
<tr>
|
||||
<td><?=$profil['idClient']?></td>
|
||||
<td><?=$profil['nom']?></td>
|
||||
<td><?=$profil['login']?></td>
|
||||
<td><?=$profil['reference']?></td>
|
||||
<td><?=$profil['tarifLigne']?></td>
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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 ) {
|
||||
|
@ -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
|
||||
|
@ -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'].')';
|
||||
@ -1180,10 +1180,10 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function getValueLabelCodeinsee($values)
|
||||
public function getValueLabelCodesinsee($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 ) {
|
||||
|
@ -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]
|
||||
|
@ -438,10 +438,6 @@ ul#fieldsblock li div.fieldgrp div.field .interval input[type=text] {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#dialogcritere ul li {
|
||||
line-height:16px;
|
||||
}
|
||||
|
||||
#dialogcritere a.remove {
|
||||
margin:0;
|
||||
padding:0;
|
||||
|
@ -31,19 +31,14 @@ profil.mail.email.supportdev = supportdev@scores-decisions.com
|
||||
profil.mail.email.contact = supportdev@scores-decisions.com
|
||||
profil.mail.email.production = supportdev@scores-decisions.com
|
||||
profil.path.data = "/home/vhosts/data"
|
||||
profil.db.ciblage.adapter=mysqli
|
||||
profil.db.ciblage.params.host=127.0.0.1
|
||||
profil.db.ciblage.params.username=ciblage
|
||||
profil.db.ciblage.params.password=z7jq8AhvrwqQJ4Yb
|
||||
profil.db.ciblage.params.dbname=ciblage
|
||||
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
profil.db.jo.adapter=mysqli
|
||||
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.db.metier.adapter=mysqli
|
||||
profil.db.metier.params.host=192.168.3.30
|
||||
profil.db.metier.params.username=ciblage
|
||||
profil.db.metier.params.password=z7jq8AhvrwqQJ4Yb
|
||||
profil.db.metier.params.dbname=jo
|
||||
profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
profil.sphinx.host=127.0.0.1
|
||||
profil.sphinx.port=3312
|
||||
|
||||
|
@ -23,27 +23,22 @@ autoloaderNamespaces[] = "Form_"
|
||||
|
||||
; Scores configuration
|
||||
profil.server.name = development
|
||||
profil.webservice.location = sdsrvdev01
|
||||
profil.webservice.location = local
|
||||
profil.mail.method = smtp
|
||||
profil.mail.smtp_host = smtp.free.fr
|
||||
profil.mail.email.support = supportdev@scores-decisions.com
|
||||
profil.mail.email.supportdev = supportdev@scores-decisions.com
|
||||
profil.mail.email.contact = supportdev@scores-decisions.com
|
||||
profil.mail.email.production = supportdev@scores-decisions.com
|
||||
profil.path.data = "d:\www\dataciblage"
|
||||
profil.db.ciblage.adapter=mysqli
|
||||
profil.db.ciblage.params.host=127.0.0.1
|
||||
profil.db.ciblage.params.username=root
|
||||
profil.db.ciblage.params.password=bj10sx
|
||||
profil.db.ciblage.params.dbname=ciblage
|
||||
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
profil.db.jo.adapter=mysqli
|
||||
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.path.data = "your/data/path
|
||||
|
||||
profil.db.metier.adapter=mysqli
|
||||
profil.db.metier.params.host=192.168.78.230
|
||||
profil.db.metier.params.username=ciblage
|
||||
profil.db.metier.params.password=z7jq8AhvrwqQJ4Yb
|
||||
profil.db.metier.params.dbname=jo
|
||||
profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
profil.sphinx.host=192.168.78.252
|
||||
profil.sphinx.port=3312
|
||||
|
||||
|
@ -31,19 +31,14 @@ profil.mail.email.supportdev = supportdev@scores-decisions.com
|
||||
profil.mail.email.contact = supportdev@scores-decisions.com
|
||||
profil.mail.email.production = supportdev@scores-decisions.com
|
||||
profil.path.data = "d:\www\dataciblage"
|
||||
profil.db.ciblage.adapter=mysqli
|
||||
profil.db.ciblage.params.host=127.0.0.1
|
||||
profil.db.ciblage.params.username=root
|
||||
profil.db.ciblage.params.password=bj10sx
|
||||
profil.db.ciblage.params.dbname=ciblage
|
||||
profil.db.ciblage.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
profil.db.jo.adapter=mysqli
|
||||
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.db.metier.adapter=mysqli
|
||||
profil.db.metier.params.host=192.168.78.230
|
||||
profil.db.metier.params.username=ciblage
|
||||
profil.db.metier.params.password=z7jq8AhvrwqQJ4Yb
|
||||
profil.db.metier.params.dbname=jo
|
||||
profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
profil.sphinx.host=192.168.78.252
|
||||
profil.sphinx.port=3312
|
||||
|
||||
|
@ -43,9 +43,9 @@ if(isset($opts->help))
|
||||
}
|
||||
|
||||
$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()
|
||||
->where('idProfil != ?', 0)
|
||||
|
@ -56,13 +56,7 @@ Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
|
||||
|
||||
//Définition bdd
|
||||
try {
|
||||
$db = Zend_Db::factory($config->profil->db->ciblage);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
//Définition bdd metier
|
||||
try {
|
||||
$dbMetier = Zend_Db::factory($config->profil->db->jo);
|
||||
$db = Zend_Db::factory($config->profil->db->metier);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
@ -72,12 +66,12 @@ $liste = array();
|
||||
if ($opts->id)
|
||||
{
|
||||
//Read SIRETs
|
||||
$commandesM = new Application_Model_EnrichissementIdentifiants($db);
|
||||
$commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
|
||||
$commande = $commandesM->find(intval($opts->id))->current();
|
||||
$identifiants = json_decode($commande->identifiants, true);
|
||||
|
||||
//Read profil for data extract
|
||||
$profilM = new Application_Model_EnrichissementProfils($db);
|
||||
$profilM = new Application_Model_CiblageEnrichissementProfils();
|
||||
$profil = $profilM->find(intval($commande->idProfil))->current();
|
||||
$dataProfil = json_decode($profil->criteres, true);
|
||||
}
|
||||
|
@ -45,13 +45,7 @@ if(isset($opts->help))
|
||||
|
||||
$config = new Zend_Config($application->getOptions());
|
||||
try {
|
||||
$db = Zend_Db::factory($config->profil->db->ciblage);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
//Définition bdd metier
|
||||
try {
|
||||
$dbMetier = Zend_Db::factory($config->profil->db->jo);
|
||||
$db = Zend_Db::factory($config->profil->db->metier);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
@ -85,7 +79,7 @@ $keys = array(
|
||||
'bilYP',
|
||||
);
|
||||
|
||||
$sql = 'TRUNCATE TABLE fields_minmax';
|
||||
$sql = 'TRUNCATE TABLE ciblage.fields_minmax';
|
||||
if ( !$db->query($sql) ) {
|
||||
die ('Impossible de vider la table fields_minmax');
|
||||
}
|
||||
@ -93,7 +87,7 @@ if ( !$db->query($sql) ) {
|
||||
foreach($keys as $key) {
|
||||
|
||||
//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);
|
||||
$result = $stmt->fetchObject();
|
||||
|
||||
@ -103,7 +97,7 @@ foreach($keys as $key) {
|
||||
'min' => $result->min,
|
||||
'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) print("Terminé\n");
|
||||
|
Loading…
Reference in New Issue
Block a user