Correction partiel des départements.

This commit is contained in:
Damien LASSERRE 2012-04-06 15:15:13 +00:00
parent 17e152ce0b
commit 7c18e4a4b1
6 changed files with 72 additions and 8 deletions

View File

@ -65,6 +65,31 @@ class Object_Comptage extends Libs_Row
if(in_array($key, array('adr_dept', 'adr_com', 'adr_reg', 'adr_com_ex')))
{
$valeurs = explode(',', $valeur);
if($key == 'adr_dept') {
$reg_ = $session->getCritere('adr_reg');
if(!empty($reg_)) {
$reg_ = explode(',', $reg_);
$table = new Table_Departements();
$result = array();
foreach($reg_ as $item) {
$sql = $table->select()->where('codeRegionInsee = ?', $item);
$donner = $table->fetchAll($sql)->toArray();
foreach ($donner as $don) {
$result[] = $don['numdep'];
}
foreach($result as $dep) {
if(in_array($dep, $valeurs)) {
$diff[] = $dep;
}
}
$session->unsetCritereValue('adr_reg', $item);
}
}
}
/*$session->unsetCritere('adr_dept');
$session->unsetCritere('adr_reg');
$session->unsetCritere('adr_com');*/
foreach($valeurs as $valeur)
{
$type = explode(':', $valeur);

View File

@ -1,7 +1,13 @@
<div id="geographique">
<ul id="fieldsblock">
<li><?php echo $this->Field('adr_com', $this->fields->get('adr_com'));?></li>
<li style="background-image:none;height:100px;">
<li>
<p style="float:left;"><b>Selection manuel</b></p>
<a class="manuel" ref="localisation" style="margin-right:10px;color:blue;font-size:10px;">
<img style="float:right;" src="/themes/default/images/plus.gif" />
</a>
</li>
<li class="localisation" style="background-image:none;height:100px;">
<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>
@ -10,7 +16,7 @@
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="adr_com" />
</li>
<li style="background-image:none;height:100px;">
<li class="localisation" style="background-image:none;height:100px;">
<div id="adr_dept_ex" class="exclusion" style="display:none">
<?php echo $this->Field('adr_dept_ex', $this->fields->get('adr_dept_ex'), 'text');?>
</div>
@ -19,7 +25,7 @@
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="adr_dept" />
</li>
<li style="background-image:none;height:100px;">
<li class="localisation" style="background-image:none;height:100px;">
<div id="adr_reg_ex" class="exclusion" style="display:none">
<?php echo $this->Field('adr_reg_ex', $this->fields->get('adr_reg_ex'), 'text');?>
</div>

View File

@ -1,9 +1,13 @@
<div id="juridique">
<ul id="fieldsblock">
<li style="height:35px;">
<?php echo $this->Field('cj', $this->fields->get('cj'));?>
<li><?php echo $this->Field('cj', $this->fields->get('cj'));?></li>
<li>
<p style="float:left;"><b>Selection manuel</b></p>
<a class="manuel" ref="juridique" style="margin-right:10px;color:blue;font-size:10px;">
<img style="float:right;" src="/themes/default/images/plus.gif" />
</a>
</li>
<li style="background-image:none;height:100px;">
<li class="juridique" 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>

View File

@ -363,7 +363,7 @@ Class Fields
),
//geographique
'adr_com' => array(
'label' => 'Code commune Insee',
'label' => 'Localisation géographique',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)

View File

@ -56,7 +56,28 @@ class SessionCiblage
unset($this->valeur[$key]);
$this->setSession();
}
}
}
public function unsetCritereValue($key, $valeur) {
if(key_exists($key, $this->valeur)) {
$don = explode(',', $this->valeur[$key]);
foreach ($don as $val) {
if($val == $valeur)
$don[key($don)] = '';
else
$new[] = $val;
}
if(count($new)>0)
{
$don = implode(',', $new);
if(!empty($don))
$this->valeur[$key] = $don;
} else {
unset($this->valeur[$key]);
}
$this->setSession();
}
}
/**
* Récupération de la valeur d'un critère

View File

@ -26,5 +26,13 @@ $(document).ready(function(){
$('<div id="dialogsaveciblage"></div>').dialog(dialogOpts);
return false;
});
$('.manuel').click( function(){
var id = $(this).attr('ref');
if($('.'+id).css('display') == 'none')
$('.'+id).show('blind');
else
$('.'+id).hide('blind');
});
});