Exclusions

voir #0001117 mantis
This commit is contained in:
Damien LASSERRE 2012-04-05 15:50:33 +00:00
parent 9db6f449a1
commit 3d867a8c7f
10 changed files with 225 additions and 23 deletions

View File

@ -39,6 +39,10 @@ class GeographiqueController extends Libs_Controller
$output = $this->completedReg($request->getParam('q'));
} else if($request->getParam('vil')) {
$output = $this->completedVil($request->getParam('q'));
}else if($request->getParam('adr_com')) {
$output = $this->completedVil($request->getParam('q'));
}else if($request->getParam('adr_com_ex')) {
$output = $this->completedVil($request->getParam('q'));
}
echo json_encode($output);

View File

@ -62,7 +62,7 @@ class Object_Comptage extends Libs_Row
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
if(in_array($key, array('adr_dept', 'adr_com', 'adr_reg')))
if(in_array($key, array('adr_dept', 'adr_com', 'adr_reg', 'adr_com_ex')))
{
$valeurs = explode(',', $valeur);
foreach($valeurs as $valeur)
@ -84,6 +84,9 @@ class Object_Comptage extends Libs_Row
default:
$vil .= trim($valeur).',';
break;
case 'adr_com_ex':
$adr_com_ex .= trim($valeur).',';
break;
}
}
if(strlen($dept)>0) {
@ -98,6 +101,10 @@ class Object_Comptage extends Libs_Row
$vil = substr($vil, 0, strlen($vil)-1);
$session->setCritere('adr_com', $vil);
}
if(strlen($adr_com_ex)>0) {
$adr_com_ex = substr($adr_com_ex, 0, strlen($adr_com_ex)-1);
$session->setCritere('adr_com_ex', $adr_com_ex);
}
} else
$session->setCritere($key, $valeur);

View File

@ -41,6 +41,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$label = 'Localisation Régions';
break;
case 'vil':
case 'adr_com':
$label = 'Localisation Villes';
break;
case 'dep':
@ -139,13 +140,13 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$session = new SessionCiblage();
$sessionValeur = $session->getCritere($name);
if(is_array($sessionValeur))
$sessionValeur = implode(',', $sessionValeur);
/*if(is_array($sessionValeur))
$sessionValeur = implode(',', $sessionValeur);*/
$return = '<select size="'.count($field['fields'][$field['type']]['value']).'" class="criteres '.$field['type']['class'].'" name="'.$name.'" multiple>';
$return .= '<option '.(($sessionValeur == 'tous')?'selected':'').' value="tous">Tous</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$selected = "";
if(($sessionValeur != null) and $sessionValeur == $value and $sessionValeur != "tous")
if(($sessionValeur != null) and in_array($value, $sessionValeur) and $sessionValeur != "tous")
$selected = " selected";
$return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
}
@ -214,9 +215,16 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
case 'vil':
$type= 'Vil';
break;
case 'adr_com':
case 'adr_com_ex':
$type= $name;
break;
case 'cj':
$type = 'Cj';
break;
case 'cj_ex':
$type = 'Cj_ex';
break;
}
/* Modifier les données */
$return = '<textarea rows="5" style="border:1px inset silver;width:60%" class="criteres complited'.$type.'" id="textarea_'.$name.'" name="'.$name.'">'.$session->getCritere($name).'</textarea>';

View File

@ -1,10 +1,26 @@
<div id="financiere">
<ul id="fieldsblock">
<li style="background: none; height:150px;"><?php echo $this->Field('avisCs', $this->fields->get('avisCs'));?></li>
<li style="background: none; height:150px;">
<div id="avisCs_ex" class="exclusion" style="display:none">
<?php echo $this->Field('avisCs_ex', $this->fields->get('avisCs_ex'));?>
</div>
<div id="avisCs_in" class="inclusion">
<?php echo $this->Field('avisCs', $this->fields->get('avisCs'));?>
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="avisCs" />
</li>
<li><?php echo $this->Field('bilAnnee', $this->fields->get('bilAnnee'));?></li>
<li><?php echo $this->Field('bilCloture', $this->fields->get('bilCloture'));?></li>
<li><?php echo $this->Field('bilDuree', $this->fields->get('bilDuree'));?></li>
<li style="background: none; height:170px;"><?php echo $this->Field('bilTca', $this->fields->get('bilTca'));?></li>
<li style="background: none; height:190px;">
<div id="bilTca_ex" class="exclusion" style="display:none">
<?php echo $this->Field('bilTca_ex', $this->fields->get('bilTca_ex'));?>
</div>
<div id="bilTca_in" class="inclusion">
<?php echo $this->Field('bilTca', $this->fields->get('bilTca'));?>
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="bilTca" />
</li>
<li><?php echo $this->Field('bilEE', $this->fields->get('bilEE'));?></li>
<li><?php echo $this->Field('bilFL', $this->fields->get('bilFL'));?></li>
<li><?php echo $this->Field('bilFK', $this->fields->get('bilFK'));?></li>

View File

@ -2,7 +2,13 @@
<ul id="fieldsblock">
<li><?php echo $this->Field('adr_com', $this->fields->get('adr_com'));?></li>
<li style="background-image:none;height:80px;">
<?php echo $this->Field('vil', $this->fields->get('adr_com'), 'text');?>
<div id="adr_com_ex" class="exclusion" style="display:none">
<?php echo $this->Field('adr_com_ex', $this->fields->get('adr_com_ex'), 'text');?>
</div>
<div id="adr_com_in" class="inclusion">
<?php echo $this->Field('adr_com', $this->fields->get('adr_com'), 'text');?>
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="adr_com" />
</li>
<li style="background-image:none;height:80px;">
<?php echo $this->Field('adr_dept', $this->fields->get('adr_dept'), 'text');?>

View File

@ -1,8 +1,16 @@
<div id="juridique">
<ul id="fieldsblock">
<li><?php echo $this->Field('cj', $this->fields->get('cj'));?></li>
<li style="background-image:none;height:80px;">
<?php echo $this->Field('cj', $this->fields->get('cj'), 'text');?>
<li style="height:35px;">
<?php echo $this->Field('cj', $this->fields->get('cj'));?>
</li>
<li style="background-image:none;height:100px;">
<div id="cj_text_ex" class="exclusion" style="display:none">
<?php echo $this->Field('cj_ex', $this->fields->get('cj_ex'), 'text');?>
</div>
<div id="cj_text_in" class="inclusion">
<?php echo $this->Field('cj', $this->fields->get('cj'), 'text');?>
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="cj_text" />
</li>
<li><?php echo $this->Field('actifEco', $this->fields->get('actifEco'));?></li>
<li><?php echo $this->Field('procolHisto', $this->fields->get('procolHisto'));?></li>

View File

@ -32,7 +32,7 @@ Class Ciblage
{
$this->need = true;
$configuration = Zend_Registry::get('configuration');
print_r($structure);
//Instantiation Sphinx
$this->sphinx = new SphinxClient();
$this->sphinx->SetServer($configuration->sphinx->host, intval($configuration->sphinx->port));
@ -97,18 +97,18 @@ Class Ciblage
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
return ($resSphinx['total_found']);
}
protected function setFilter($name, $valeur) {
protected function setFilter($name, $valeur, $ex = false) {
if(!is_array($valeur)) {
$this->sphinx->SetFilter($name, array(intval($valeur)));
$this->sphinx->SetFilter($name, array(intval($valeur)),($ex)?true:false);
}else {
$this->sphinx->SetFilter($name, $this->transformIntval($valeur));
$this->sphinx->SetFilter($name, $this->transformIntval($valeur), ($ex)?true:false);
}
}
protected function setFilterRange($name, $valeur) {
$this->sphinx->SetFilterRange($name, intval($valeur[0]), intval($valeur[1]));
}
protected function writeRequest($name, $valeur, $or = false) {
$this->alpha .= '@'.$name . ' (';
protected function writeRequest($name, $valeur, $or = false, $ex =false) {
$this->alpha .= '@'.$name . (($ex)?'-':'').' (';
if(!is_array($valeur)) {
$this->alpha .= $valeur.')';
} else {
@ -123,7 +123,7 @@ Class Ciblage
}
}
protected function setAlpha($name, $valeur)
protected function setAlpha($name, $valeur, $ex = false)
{
$or = array('adr_com', 'adr_dept');
$and = array('bilType', 'ape_etab','ape_entrep', 'NaceEntrep', 'NaceEtab');
@ -153,6 +153,10 @@ Class Ciblage
protected function adr_com($valeur) {
$this->setAlpha('adr_com', $valeur);
}
protected function adr_com_ex($valeur) {
print_r($valeur);
$this->setAlpha('adr_com', $valeur, true);
}
protected function adr_dept($valeur) {
$this->setAlpha('adr_dept', $valeur);
}
@ -171,6 +175,9 @@ Class Ciblage
protected function cj($valeur) {
$this->setFilter('cj', $valeur);
}
protected function cj_ex($valeur) {
$this->setFilter('cj', $valeur, true);
}
protected function capital($valeur) {
$valeur = $this->setMinMax($name, $valeur);
@ -315,6 +322,9 @@ Class Ciblage
protected function bilTca($valeur) {
$this->setFilter('bilTca', $valeur);
}
protected function bilTca_ex($valeur) {
$this->setFilter('bilTca', $valeur, true);
}
protected function bilEE($valeur) {
$valeur = $this->setMinMax('bilEE', $valeur);
$this->setFilterRange('bilEE', $valeur);
@ -368,9 +378,21 @@ Class Ciblage
$this->setFilterRange('bilYP', $valeur);
}
protected function avisCs($valeur) {
$valeur = explode('-', $valeur);
foreach ($valeur as $val) {
$string .= '-'.$val;
}
$string = substr($string, 1);
$valeur = explode('-', $string);
$this->setFilter('avisCs', $valeur);
}
protected function avisCs_ex($valeur) {
foreach ($valeur as $val) {
$string .= '-'.$val;
}
$string = substr($string, 1);
$valeur = explode('-', $string);
$this->setFilter('avisCs', $valeur, true);
}
protected function bilFS($valeur) {
$this->setFilterRange('bilFS', $valeur);
}
@ -408,4 +430,23 @@ Class Ciblage
}
$this->setFilterRange('bilCloture', $valeur);
}
protected function zru($valeur) {
$this->setFilter('zru', $valeur);
}
protected function zus($valeur){
$this->setFilter('zus', $valeur);
}
protected function zfu($valeur){
$this->setFilter('zfu', $valeur);
}
protected function cucs($valeur){
$this->setFilter('cucs', $valeur);
}
protected function zrr($valeur){
$this->setFilter('zrr', $valeur);
}
protected function zafr($valeur){
$this->setFilter('zafr', $valeur);
}
}

View File

@ -375,6 +375,19 @@ Class Fields
'action' => 'geographique',
'title' => 'Localisation'
),
'adr_com_ex' => array(
'label' => 'Code commune Insee',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'geographique',
'activated' => true,
'type' => 'textarea',
'class' => null,
'action' => 'geographique',
'title' => 'Localisation'
),
'adr_dept' => array(
'label' => 'Liste départements',
'fields' => array(
@ -469,6 +482,19 @@ Class Fields
'action' => 'juridique',
'title' => 'Forme Juridique'
),
'cj_ex' => array(
'label' => 'Forme Juridique (Exclure)',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'juridique',
'activated' => true,
'type' => 'textarea',
'class' => null,
'action' => 'juridique',
'title' => 'Forme Juridique'
),
'actifEco' => array(
'label' => 'Établissement économiquement actif',
'fields' => array(
@ -543,6 +569,25 @@ Class Fields
'type' => 'selectMultiple',
'class' => null
),
'avisCs_ex' => array(
'label' => 'Informations de paiements (Exclure)',
'fields' => array(
'selectMultiple' => array('value' => array(
'' => 'Risque indéterminé',
'00' => 'Aucun risque resencé',
'10' => 'Présence d\'impayé(s)',
'15' => 'Présence de privilèges',
'23-29-39-43' => 'Risque moyen',
'21-26-28' => 'Risque important',
'31-50' => 'Risque très important',
'24' => 'Risque dans le groupe')
),
),
'famille' => 'financier',
'activated' => true,
'type' => 'selectMultiple',
'class' => null
),
'bilDuree' => array(
'label' => 'Durée du dernier bilan en mois',
'fields' => array(
@ -582,6 +627,27 @@ Class Fields
'type' => 'selectMultiple',
'class' => null
),
'bilTca_ex' => array(
'label' => 'Tranche de CA issue du bilan (Exclure)',
'fields' => array(
'selectMultiple' => array('value' => array(
'0' => 'Non déterminée',
'1' => 'de 500K€ à1M€',
'2' => 'de 1 à 2 ME',
'3' => 'de 2 à 5 ME',
'4' => 'de 5 à 10 ME',
'5' => 'de 10 à 20 ME',
'6' => 'de 20 à 50 ME',
'7' => '50 à 100 ME',
'8' => 'de 100 à 200 ME',
'9' => '+ de 200 ME'
)),
),
'famille' => 'financier',
'activated' => true,
'type' => 'selectMultiple',
'class' => null
),
'bilAnnee' => array(
'label' => 'Dernière année de bilan',
'fields' => array(
@ -762,10 +828,12 @@ Class Fields
$values['adr_dept'] = array_merge($this->selectArbo($key, $item), $values['adr_dept']);
else
$values['adr_dept'] = $this->selectArbo($key, $item);
}else
}else {
$values[$key] = $this->selectArbo($key, $item);
}
}
} else {
echo 'ici';exit;
$values[$key] = $item;
}
}
@ -810,6 +878,7 @@ Class Fields
}
break;
case 'cj':
case 'cj_ex':
$valeurs = explode(',', $valeur);
foreach($valeurs as $valeur) {
if($valeur != ' ' and !empty($valeur))

View File

@ -23,6 +23,23 @@ $(document).ready(function(){
}
});
$('textarea.complitedCj_ex').autocomplete({
delay:300,
source: function(request, response) {
$.getJSON('/juridique/completed', { q: extractLast( request.term ) },
function(data) { response(data); }
);
},
select: function(event, ui){
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
$('textarea.complitedNaf').autocomplete({
delay:600,
source: function(request, response) {
@ -74,10 +91,27 @@ $(document).ready(function(){
}
});
$('textarea.complitedVil').autocomplete({
$('textarea.complitedadr_com').autocomplete({
delay:600,
source: function(request, response) {
$.getJSON('/geographique/completed/vil/1', { q: extractLast( request.term ) },
$.getJSON('/geographique/completed/adr_com/1', { q: extractLast( request.term ) },
function(data) { response(data); }
);
},
select: function(event, ui){
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
$('textarea.complitedadr_com_ex').autocomplete({
delay:600,
source: function(request, response) {
$.getJSON('/geographique/completed/adr_com_ex/1', { q: extractLast( request.term ) },
function(data) { response(data); }
);
},

View File

@ -41,7 +41,7 @@ $(document).ready(function()
set(name, ui.values[ 0 ] + "," + ui.values[ 1 ]);
}
});
$("input.datepicker").datepicker({ dateFormat: 'dd/mm/yy' } );
$( "#accordion" ).accordion({
@ -103,7 +103,6 @@ $(document).ready(function()
e.preventDefault();
var key = $(this).attr('textarea');
var values = $('#textarea_'+$(this).attr('textarea')).val();
set(key, values);
return false;
});
@ -202,6 +201,16 @@ $(document).ready(function()
$('<div id="dialogsaveciblage"></div>').dialog(dialogOpts);
return false;
});
$('.checkbox_ex').click(function(){
if($(this).is(':checked')) {
$('#'+$(this).attr('name')+'_in').css('display', 'none');
$('#'+$(this).attr('name')+'_ex').css('display', 'block');
} else {
$('#'+$(this).attr('name')+'_in').css('display', 'block');
$('#'+$(this).attr('name')+'_ex').css('display', 'none');
}
});
});
function set(key, value)