Add customer params and correct exclude on NAF
This commit is contained in:
parent
27d8212a18
commit
4d9951d9d4
@ -13,6 +13,7 @@ resources.session.cookie_lifetime = 86400
|
||||
resources.session.remember_me_seconds = 86400
|
||||
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
|
||||
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
|
||||
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Params"
|
||||
resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.layout.layout = "main"
|
||||
|
@ -11,4 +11,10 @@ class AideController extends Zend_Controller_Action
|
||||
|
||||
public function aproposdeAction(){}
|
||||
|
||||
public function messageAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$this->view->assign('typeMsg', $request->getParam('typeMsg'));
|
||||
}
|
||||
|
||||
}
|
@ -18,23 +18,25 @@ class ComptageController extends Zend_Controller_Action
|
||||
//Set the flag for exclusion
|
||||
$exclude = $request->getParam('exclude');
|
||||
$ex = false;
|
||||
if ( !empty($exclude) ) {
|
||||
if ( intval($exclude)==1 ) {
|
||||
$ex = true;
|
||||
}
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
$fields->setCritere($cle, $valeur, $ex);
|
||||
|
||||
//Informations utilisateur
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($fields->getValues());
|
||||
$ciblage = new Ciblage($fields->getValues(), $user->filterRNCS);
|
||||
|
||||
//@todo : if $total = false then an error occured ?
|
||||
$total = $ciblage->execute();
|
||||
$fields->setNb('total', $total);
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
if ($user->preferences['interface']['insee']==1) {
|
||||
$insee = $ciblage->calculRedevanceInsee();
|
||||
} else {
|
||||
@ -113,7 +115,7 @@ class ComptageController extends Zend_Controller_Action
|
||||
//If nbInsee == null, need to count again
|
||||
if ($nbInsee===null) {
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($criteres);
|
||||
$ciblage = new Ciblage($criteres, $user->filterRNCS);
|
||||
$nbInsee = $ciblage->calculRedevanceInsee();
|
||||
}
|
||||
|
||||
@ -159,9 +161,12 @@ class ComptageController extends Zend_Controller_Action
|
||||
$field = new Scores_Fields();
|
||||
$values = $field->getValues($structure);
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($values);
|
||||
$ciblage = new Ciblage($values, $user->filterRNCS);
|
||||
|
||||
$data = array(
|
||||
'idDefinition' => $idCriteres,
|
||||
@ -189,11 +194,14 @@ class ComptageController extends Zend_Controller_Action
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($fields->getValues());
|
||||
$ciblage = new Ciblage($fields->getValues(), $user->filterRNCS);
|
||||
$sirets = $ciblage->execute(true, 10);
|
||||
|
||||
$dbConfig = Zend_Registry::get('configuration')->databases;
|
||||
@ -203,9 +211,7 @@ class ComptageController extends Zend_Controller_Action
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
|
||||
//Make SQL request with the user profil for columns
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
//Make SQL request with the user profil for columns
|
||||
$profilsM = new Application_Model_EnrichissementProfils();
|
||||
$sql = $profilsM->select()
|
||||
->where('login = ?', $user->username)
|
||||
|
@ -303,6 +303,8 @@ class DashboardController extends Zend_Controller_Action
|
||||
}
|
||||
}
|
||||
|
||||
//Customer params have an option on the RNCS filter
|
||||
$this->view->assign('filterRNCS', $user->filterRNCS);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -357,6 +359,8 @@ class DashboardController extends Zend_Controller_Action
|
||||
|
||||
$nbRow = $prefsM->update(array('json'=>$newjson), "login='".$user->username."'");
|
||||
|
||||
//Don't forget to save new preferences in session
|
||||
|
||||
$this->view->assign('nbRow', $nbRow);
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ class EnrichissementController extends Zend_Controller_Action
|
||||
$ref = $request->getParam('ref');
|
||||
|
||||
//Vérifier les profils du client
|
||||
if ( $idProfil===null ){
|
||||
if ( $idProfil===null ) {
|
||||
|
||||
//Selection du profil du client
|
||||
$auth = Zend_Auth::getInstance();
|
||||
@ -108,7 +108,7 @@ class EnrichissementController extends Zend_Controller_Action
|
||||
|
||||
//Récupération des SIRET
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($structure, true);
|
||||
$ciblage = new Ciblage($structure, $user->filterRNCS);
|
||||
$infosExtraction = $ciblage->execute(true);
|
||||
|
||||
|
||||
|
@ -232,4 +232,34 @@ class GestionController extends Zend_Controller_Action
|
||||
$this->view->comptages = $comptages;
|
||||
}
|
||||
|
||||
/**
|
||||
* List customers
|
||||
*/
|
||||
public function customerparamsAction()
|
||||
{
|
||||
//@todo : Get customer list from webservice
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List customer's params
|
||||
*/
|
||||
public function customerparamAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$idClient= $request->getParam('id', null);
|
||||
|
||||
if ($idClient !== null) {
|
||||
$paramsM = new Application_Model_CustomerParams();
|
||||
$params = $paramsM->find($idClient);
|
||||
$infos = null;
|
||||
if ($params->count()>0){
|
||||
$infos = $params->toArray();
|
||||
}
|
||||
$this->view->assign('infos',$infos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -95,17 +95,18 @@ class IndexController extends Zend_Controller_Action
|
||||
$fields->unsetCritereValue($nameCritereToDelete, $posExList, true);
|
||||
} else {
|
||||
$fields->unsetCritere($nameCritereToDelete);
|
||||
}
|
||||
}
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($fields->getValues());
|
||||
$ciblage = new Ciblage($fields->getValues(), $user->filterRNCS);
|
||||
|
||||
$total = $ciblage->execute();
|
||||
$fields->setNb('total', $total);
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
if ($user->preferences['interface']['insee']==1) {
|
||||
$insee = $ciblage->calculRedevanceInsee();
|
||||
} else {
|
||||
|
5
application/models/CustomerParams.php
Normal file
5
application/models/CustomerParams.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_CustomerParams extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'customer_params';
|
||||
}
|
@ -1,6 +1,12 @@
|
||||
<div id="help">
|
||||
|
||||
<h2>Description de l'interface</h2>
|
||||
<p>
|
||||
Menu
|
||||
|
||||
Résumé des critères
|
||||
|
||||
</p>
|
||||
<br/>
|
||||
|
||||
|
||||
|
8
application/views/default/scripts/aide/message.phtml
Normal file
8
application/views/default/scripts/aide/message.phtml
Normal file
@ -0,0 +1,8 @@
|
||||
<div id="help">
|
||||
<?php if ($this->typeMsg == 'support') {?>
|
||||
Les paramètres de votre compte n'ont pas été définis. <br/>Veuillez contacter le <a href="mailto:support@scores-decisions.com">support</a>.
|
||||
<br/>Par mail : <a href="mailto:support@scores-decisions.com">support@scores-decisions.com</a>
|
||||
<br/>Par téléphone : 00 00 00 00 00
|
||||
<br/>Ou contactez votre commercial.
|
||||
<?php }?>
|
||||
</div>
|
@ -13,7 +13,7 @@
|
||||
<div id="dashboard">
|
||||
|
||||
|
||||
<h2>Gestion des profils d'enrichissement</h2>
|
||||
<h2>Profils d'enrichissement</h2>
|
||||
<p>
|
||||
Afin de vous permettre un enrichissement de données à partir d'une liste de SIREN/SIRET,
|
||||
Suivant la configuration de votre compte, vous avez la possibilité de sélectionner les données
|
||||
@ -33,7 +33,7 @@ disponible.
|
||||
<p>Lister les colonnes disponibles (Association SQL/Libellé) pour la configuration<p>
|
||||
|
||||
|
||||
<h2>Gestion des préférences d'affichage</h2>
|
||||
<h2>Préférences d'affichage</h2>
|
||||
<p>
|
||||
L'application permet la modification de l'affichage des critères de ciblage afin de permettre une
|
||||
utilisation correspondant à vos besoins.
|
||||
@ -50,14 +50,20 @@ utilisation correspondant à vos besoins.
|
||||
<label>Afficher le nombre d'unité INSEE</label><br/>
|
||||
<span><i>Pour permettre une estimation du cout de la redevance INSEE, en activant cette option,
|
||||
le nombre d'unité insee est affiché à chaque comptage</i></span><br/>
|
||||
<input type="checkbox" name="insee" value="1" <?php if ($this->prefInterfaceInsee==1) echo ' checked="checked"';?> />
|
||||
<input type="checkbox" name="insee" value="1" <?php if ($this->prefInterfaceInsee==1) echo ' checked="checked"';?>
|
||||
<?php if ($this->filterRNCS==1) echo ' disabled="disable"';?>/>
|
||||
</div>
|
||||
<br/>
|
||||
<div>
|
||||
<label>Filtrer au seul périmètre RNCS </label><br/>
|
||||
<span>Les éléments soumis à redevance INSEE sont automatiquement retirer du ciblage</span><br/>
|
||||
<input type="checkbox" name="rncs" value="1" <?php if ($this->prefFilterRncs==1) echo ' checked="checked"';?> />
|
||||
<input type="checkbox" name="rncs" value="1" <?php if ($this->prefFilterRncs==1) echo ' checked="checked"';?>
|
||||
<?php if ($this->filterRNCS==1) echo ' disabled="disable"';?> />
|
||||
</div>
|
||||
<?php if ($this->filterRNCS==1) {?>
|
||||
<i>Votre compte est paramétré pour filtrer RNCS</i>
|
||||
<?php }?>
|
||||
|
||||
|
||||
<script>
|
||||
$('input[type=checkbox]').click(function(){
|
||||
@ -78,4 +84,13 @@ Activer le mode personnalisation
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br/>
|
||||
|
||||
<h2>Paramètres de votre compte</h2>
|
||||
<p>Licence INSEE : paiement à chaque extraction, non comptabilisé (déjà licencié)</p>
|
||||
<p>Filtre RNCS : actif, désactiver</p>
|
||||
<p>Extraction possible de xxx lignes, nombre de fichiers illimités sur la durée du contrat</p>
|
||||
<p>Extraction possible de xxx lignes par fichier, nombre de fichiers maximums x sur la durée du contrat</p>
|
||||
|
||||
|
||||
</div>
|
@ -0,0 +1,6 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<?=print_r($this->infos)?>
|
||||
|
||||
|
||||
</div>
|
@ -0,0 +1,5 @@
|
||||
<div id="dashboard">
|
||||
|
||||
|
||||
|
||||
</div>
|
@ -5,10 +5,12 @@
|
||||
<a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'profiladd'))?>">Créer un profil d'enrichissement pour un client (idClient, login)</a>
|
||||
|
||||
<h2>Gestion des commandes</h2>
|
||||
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'commandes'));?>">Liste des commandes</a><br />
|
||||
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'enrichissements'));?>">Liste des commandes terminées</a><br/>
|
||||
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'ciblages'));?>">Liste des ciblages</a><br />
|
||||
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'commandes'))?>">Liste des commandes</a><br />
|
||||
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'enrichissements'))?>">Liste des commandes terminées</a><br/>
|
||||
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'ciblages'))?>">Liste des ciblages</a><br />
|
||||
|
||||
<h2>Facturation</h2>
|
||||
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'customerparams'))?>">Gestion des paramètres clients</a><br/>
|
||||
<a href="#">Extraction Logs</a>
|
||||
|
||||
</div>
|
@ -21,9 +21,9 @@
|
||||
<label>Selection des données pour l'enrichissement</label>
|
||||
<select style="padding:5px;" name="criteres[]" multiple size="20">
|
||||
<?php if ( count($this->fields)>0 ) {?>
|
||||
<?php foreach ( $this->fields as $value => $item ) {?>
|
||||
<option value="<?=$value?>"><?=$item['label']?></option>
|
||||
<?php }?>
|
||||
<?php foreach ( $this->fields as $value => $item ) {?>
|
||||
<option value="<?=$value?>"><?=$item['label']?></option>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</select>
|
||||
</div>
|
||||
@ -31,7 +31,4 @@
|
||||
<input type="submit" name="submit" value="Enregistrer"/>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
15
config/_sql/CustomerParams.sql
Normal file
15
config/_sql/CustomerParams.sql
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `customer_params` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`idClient` int(11) NOT NULL,
|
||||
`service` varchar(100) NOT NULL,
|
||||
`filterRNCS` tinyint(1) NOT NULL COMMENT 'Filtrer sur le perimetre RNCS ',
|
||||
`licenceINSEE` tinyint(1) NOT NULL COMMENT 'Le client possede une licence INSEE',
|
||||
`dateContrat` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Date de debut du contrat',
|
||||
`periodContrat` int(2) NOT NULL COMMENT 'Dur<EFBFBD>e du contrat en mois',
|
||||
`periodPaiement` int(2) NOT NULL COMMENT 'Dur<EFBFBD>e en mois pour l''emission de la facture (1,3,6,12)',
|
||||
`limitLines` int(11) NOT NULL DEFAULT '0' COMMENT 'Limiter a un nombre de ligne sur la periode du contrat',
|
||||
`limitFiles` int(11) NOT NULL DEFAULT '0' COMMENT 'Limiter a un nombre de fichier sur la duree du contrat',
|
||||
`dateAdded` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Parametres de facturation' AUTO_INCREMENT=1 ;
|
@ -59,6 +59,9 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
||||
if ( !$auth->hasIdentity() || time() > $auth->getIdentity()->time ) {
|
||||
|
||||
$auth->clearIdentity();
|
||||
$storage = $auth->getStorage();
|
||||
Zend_Session::namespaceUnset($storage->getNamespace());
|
||||
|
||||
$session = new Zend_Session_Namespace('login');
|
||||
$session->url = $_SERVER['REQUEST_URI'];
|
||||
|
||||
|
@ -44,7 +44,7 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst
|
||||
$session->setCriteres(json_decode($row->criteres, 'true'));
|
||||
//Réalise le comptage
|
||||
$fields = new Scores_Fields();
|
||||
$ciblage = new Ciblage($fields->getValues());
|
||||
$ciblage = new Ciblage($fields->getValues(), $user->filterRNCS);
|
||||
$total = $ciblage->execute();
|
||||
$session->setNb('total', $total);
|
||||
if ($user->preferences['interface']['insee']==1) {
|
||||
|
51
library/Application/Controller/Plugin/Params.php
Normal file
51
library/Application/Controller/Plugin/Params.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
class Application_Controller_Plugin_Params extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
|
||||
if ($layout->isEnabled()
|
||||
&& $request->getControllerName()!='user'
|
||||
&& !in_array($request->getActionName(), array('login', 'logout')))
|
||||
{
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if ($auth->hasIdentity()) {
|
||||
$identity = $auth->getIdentity();
|
||||
|
||||
///Get customer's params
|
||||
$paramsM = new Application_Model_CustomerParams();
|
||||
$sql = $paramsM->select()
|
||||
->where('idClient = ?', $identity->idClient)
|
||||
->order('dateContrat DESC')->limit(1);
|
||||
Zend_Registry::get('firebug')->info($sql->__toString());
|
||||
$params = $paramsM->fetchAll($sql)->toArray();
|
||||
if (count($params)>0) {
|
||||
$identity->filterRNCS = $params[0]['filterRNCS'];
|
||||
$identity->licenceINSEE = $params[0]['licenceINSEE'];
|
||||
$identity->limitLines = $params[0]['limitLines'];
|
||||
$identity->limitFiles = $params[0]['limitFiles'];
|
||||
//@todo : Check dateContrat and calculate end of contrat
|
||||
}
|
||||
|
||||
//If no params is detected, display a message to contact support
|
||||
if (count($params)==0) {
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('aide')
|
||||
->setActionName('message')
|
||||
->setParam('typeMsg', 'support');
|
||||
}
|
||||
|
||||
//Get user's preference
|
||||
$prefsM = new Application_Model_Prefs();
|
||||
$pref = $prefsM->find($identity->username)->current();
|
||||
if ($pref) {
|
||||
$identity->preferences = json_decode($pref->json, true);
|
||||
}
|
||||
|
||||
$auth->getStorage()->write($identity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -32,16 +32,10 @@ class Scores_AuthAdapter implements Zend_Auth_Adapter_Interface
|
||||
$identity->droitsClients = $InfosLogin->result->droitsClients;
|
||||
$identity->nom = $InfosLogin->result->nom;
|
||||
$identity->prenom = $InfosLogin->result->prenom;
|
||||
$identity->tel = $InfosLogin->result->tel;
|
||||
$identity->fax = $InfosLogin->result->fax;
|
||||
$identity->mobile = $InfosLogin->result->mobile;
|
||||
$identity->id = $InfosLogin->result->id;
|
||||
$identity->idClient = $InfosLogin->result->idClient;
|
||||
$identity->reference = $InfosLogin->result->reference;
|
||||
$identity->nbReponses = $InfosLogin->result->nbReponses;
|
||||
$identity->typeScore = $InfosLogin->result->typeScore;
|
||||
$identity->dateValidation = $InfosLogin->result->dateValidation;
|
||||
$identity->nombreConnexions = $InfosLogin->result->nombreConnexions;
|
||||
$identity->dateDerniereConnexion = $InfosLogin->result->dateDerniereConnexion;
|
||||
$identity->dateDebutCompte = $InfosLogin->result->dateDebutCompte;
|
||||
$identity->dateFinCompte = $InfosLogin->result->dateFinCompte;
|
||||
@ -80,12 +74,6 @@ class Scores_AuthAdapter implements Zend_Auth_Adapter_Interface
|
||||
$message = $InfosLogin;
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message));
|
||||
} elseif ($this->_username == $InfosLogin->result->login) {
|
||||
//Get user's preference
|
||||
$prefsM = new Application_Model_Prefs();
|
||||
$pref = $prefsM->find($this->_username)->current();
|
||||
if ($pref) {
|
||||
$identity->preferences = json_decode($pref->json, true);
|
||||
}
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
|
||||
} else {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity);
|
||||
|
@ -22,13 +22,23 @@ class Ciblage
|
||||
*/
|
||||
protected $alpha = '';
|
||||
|
||||
/**
|
||||
* Marker to limit only the RNCS elements and disable all which are INSEE
|
||||
* @var int
|
||||
*/
|
||||
protected $filterRNCS = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param null|array $structure
|
||||
* @param boolean $need
|
||||
* @param boolean filterRNCS
|
||||
*/
|
||||
public function __construct($structure = null)
|
||||
public function __construct($structure = null, $filterRNCS = 0)
|
||||
{
|
||||
if ($filterRNCS===true) {
|
||||
$this->filterRNCS();
|
||||
}
|
||||
|
||||
Zend_Registry::get('firebug')->info($structure);
|
||||
|
||||
/*
|
||||
@ -49,26 +59,34 @@ class Ciblage
|
||||
$this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED2);
|
||||
$this->sphinx->ResetFilters();
|
||||
|
||||
//
|
||||
//Follow each elements
|
||||
if ( $structure!==null && count($structure)>0 ) {
|
||||
foreach($structure as $key => $valeur) {
|
||||
if ($key!= 'NB' && method_exists($this, $key)) {
|
||||
$this->{$key}($valeur);
|
||||
} else {
|
||||
Zend_Registry::get('firebug')->info('KEY:'.$key);
|
||||
Zend_Registry::get('firebug')->info('Method non exist KEY:'.$key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of status variable
|
||||
* Return array of status variables
|
||||
*/
|
||||
public function Status()
|
||||
{
|
||||
return $this->sphinx->Status();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set marker RNCS to true
|
||||
*/
|
||||
public function filterRNCS()
|
||||
{
|
||||
$this->filterRNCS = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown_type $name
|
||||
@ -131,9 +149,13 @@ class Ciblage
|
||||
*/
|
||||
public function calculRedevanceInsee()
|
||||
{
|
||||
$this->sphinx->SetFilter('presentrcs', array(0));
|
||||
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
||||
return ($resSphinx['total_found']);
|
||||
if ($this->filterRNCS!=1) {
|
||||
$this->sphinx->SetFilter('presentrcs', array(0));
|
||||
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
||||
return $resSphinx['total_found'];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,6 +180,10 @@ class Ciblage
|
||||
*/
|
||||
public function execute($need = false, $nbReturn = 0)
|
||||
{
|
||||
if ($this->filterRNCS==1) {
|
||||
$this->sphinx->SetFilter('presentrcs', array(1));
|
||||
}
|
||||
|
||||
if($need) {
|
||||
$return = array();
|
||||
$limit = 1000;
|
||||
@ -192,7 +218,7 @@ class Ciblage
|
||||
} else {
|
||||
|
||||
$this->sphinx->SetLimits(0, 1);
|
||||
//Zend_Registry::get('firebug')->info("Sphinx : ".$this->alpha);
|
||||
Zend_Registry::get('firebug')->info("Sphinx : ".$this->alpha);
|
||||
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
||||
Zend_Registry::get('firebug')->info($resSphinx);
|
||||
|
||||
@ -871,17 +897,30 @@ class Ciblage
|
||||
$req.= '('.implode('|', $valueIn).')';
|
||||
}
|
||||
if ( count($valueEx)>0 ) {
|
||||
/*
|
||||
if (empty($req)) {
|
||||
//Get all NAFs and remove excluded
|
||||
$nafM = new Application_Model_Naf();
|
||||
$sql = $nafM->select()->from($nafM, array('code'))->where('niveau = 5');
|
||||
$allnaf = $nafM->fetchAll()->toArray();
|
||||
$value = array_diff($allnaf, $valueEx);
|
||||
$req.= '('.implode('|', $value).')';
|
||||
$allnaf = $nafM->fetchAll($sql)->toArray();
|
||||
$tmp = array();
|
||||
foreach($allnaf as $code => $naf) {
|
||||
$tmp[] = $naf['code'];
|
||||
}
|
||||
Zend_Registry::get('firebug')->info($tmp);
|
||||
$value = array_diff($tmp, $valueEx);
|
||||
$req.= '('.implode('|', $value).')';
|
||||
|
||||
|
||||
} else {
|
||||
//Simply exclude
|
||||
//only exclude
|
||||
$req.= ' -('.implode('|', $valueEx).')';
|
||||
}
|
||||
}*/
|
||||
if (empty($req)) {
|
||||
$req = 'EX ';
|
||||
}
|
||||
$req.= ' -('.implode('|', $valueEx).')';
|
||||
|
||||
}
|
||||
return $req;
|
||||
}
|
||||
|
@ -807,9 +807,13 @@ Les zones urbaines sensibles constituent un sous-ensemble de l'ensemble plus lar
|
||||
|
||||
//Save the value
|
||||
if ($ex) {
|
||||
Zend_Registry::get('firebug')->info('Exclude : ');
|
||||
Zend_Registry::get('firebug')->info($value);
|
||||
$this->ciblage[$key]['ex'] = $value;
|
||||
} else {
|
||||
$this->ciblage[$key]['in'] = $value;
|
||||
Zend_Registry::get('firebug')->info('Include: ');
|
||||
Zend_Registry::get('firebug')->info($value);
|
||||
}
|
||||
$this->setSession();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user