Correction du bug avec les departements.
This commit is contained in:
parent
82a99a4efa
commit
697c7ebb5d
@ -50,9 +50,8 @@ class GeographiqueController extends Libs_Controller
|
||||
|
||||
protected function completedDep($q)
|
||||
{
|
||||
$table = new Table_Departements();
|
||||
|
||||
$sql = $table->select()
|
||||
$table = new Table_Departements();
|
||||
$sql = $table->select()
|
||||
->where('libdep LIKE "'.$q.'%"');
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
@ -80,18 +79,32 @@ class GeographiqueController extends Libs_Controller
|
||||
return ($output);
|
||||
}
|
||||
|
||||
protected function getDeptFromReg($dep)
|
||||
{
|
||||
$table = new Table_Departements();
|
||||
$sql = $table->select()
|
||||
->where('codeRegionInsee = '.$dep);
|
||||
$result = $table->fetchAll($sql)->toArray();
|
||||
$string = '';
|
||||
foreach ($result as $res) {
|
||||
$string .= $res['numdep'].',';
|
||||
}
|
||||
$string = substr($string, 0, strlen($string)-1);
|
||||
return ($string);
|
||||
}
|
||||
|
||||
protected function completedReg($q)
|
||||
{
|
||||
$table = new Table_Regions();
|
||||
$separator = ' ';
|
||||
|
||||
$sql = $table->select()
|
||||
->where('NCCENR LIKE "%'.$q.'%"');
|
||||
->where('NCCENR LIKE "%'.$q.'%" OR REGION LIKE "%'.$q.'%"');
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->NCCENR . $separator . $item->REGION,
|
||||
'value' => $item->REGION
|
||||
'label' => $item->REGION .' '.$item->NCCENR . $separator . $item->REGION,
|
||||
'value' => $this->getDeptFromReg($item->REGION)
|
||||
);
|
||||
}
|
||||
return ($output);
|
||||
|
@ -97,10 +97,8 @@ class Object_Comptage extends Libs_Row
|
||||
}
|
||||
switch($key) {
|
||||
case 'adr_dept':
|
||||
$dept .= trim($valeur).',';
|
||||
break;
|
||||
case 'adr_reg':
|
||||
$reg .= trim($valeur).',';
|
||||
$dept .= trim($valeur).',';
|
||||
break;
|
||||
case 'adr_com':
|
||||
case 'vil':
|
||||
@ -116,10 +114,6 @@ class Object_Comptage extends Libs_Row
|
||||
$dept = substr($dept, 0, strlen($dept)-1);
|
||||
$session->setCritere('adr_dept', $dept);
|
||||
}
|
||||
if(strlen($reg)>0) {
|
||||
$reg = substr($reg, 0, strlen($reg)-1);
|
||||
$session->setCritere('adr_reg', $reg);
|
||||
}
|
||||
if(strlen($vil)>0) {
|
||||
$vil = substr($vil, 0, strlen($vil)-1);
|
||||
$session->setCritere('adr_com', $vil);
|
||||
|
@ -16,24 +16,16 @@
|
||||
</div>
|
||||
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="adr_com" />
|
||||
</li>
|
||||
<li class="localisation" style="background-image:none;height:100px;">
|
||||
<li class="localisation" style="background-image:none;height:150px;">
|
||||
<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>
|
||||
<div id="adr_dept_in" class="inclusion">
|
||||
<?php echo $this->Field('adr_dept', $this->fields->get('adr_dept'), 'text');?>
|
||||
</div>
|
||||
</div><br />
|
||||
Régions : <input type="text" name="" id="textarea_adr_reg" /><br />
|
||||
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="adr_dept" />
|
||||
</li>
|
||||
<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>
|
||||
<div id="adr_reg_in" class="inclusion">
|
||||
<?php echo $this->Field('adr_reg', $this->fields->get('adr_reg'), 'text');?>
|
||||
</div>
|
||||
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="adr_reg" />
|
||||
</li>
|
||||
<li><?php echo $this->Field('zus', $this->fields->get('zus'), 'select');?></li>
|
||||
<li><?php echo $this->Field('zru', $this->fields->get('zru'), 'select');?></li>
|
||||
<li><?php echo $this->Field('zfu', $this->fields->get('zfu'), 'select');?></li>
|
||||
|
@ -82,7 +82,6 @@ Class Ciblage
|
||||
}
|
||||
public function execute($need = false)
|
||||
{
|
||||
//echo $this->alpha;
|
||||
if($need) {
|
||||
$return = array();
|
||||
$limit = 0;
|
||||
@ -109,7 +108,7 @@ Class Ciblage
|
||||
$this->sphinx->SetFilterRange($name, intval($valeur[0]), intval($valeur[1]));
|
||||
}
|
||||
protected function writeRequest($name, $valeur, $ex, $or = false) {
|
||||
$this->alpha .= '@'.$name . (($ex)?" -":" ").'(';
|
||||
$this->alpha .= ((!empty($this->alpha))?' | ':'').'@'.$name . (($ex)?" -":" ").'(';
|
||||
if(!is_array($valeur)) {
|
||||
$this->alpha .= $valeur.')';
|
||||
} else {
|
||||
|
@ -58,7 +58,10 @@ class SessionCiblage
|
||||
}
|
||||
}
|
||||
|
||||
/*Permet de supprimer une valeur dans une clef de session*/
|
||||
public function unsetCritereValue($key, $valeur) {
|
||||
|
||||
//@todo provisoir trouver une autre technique plus adapté.
|
||||
if(key_exists($key, $this->valeur)) {
|
||||
$don = explode(',', $this->valeur[$key]);
|
||||
foreach ($don as $val) {
|
||||
@ -67,8 +70,7 @@ class SessionCiblage
|
||||
else
|
||||
$new[] = $val;
|
||||
}
|
||||
if(count($new)>0)
|
||||
{
|
||||
if(count($new) > 0) {
|
||||
$don = implode(',', $new);
|
||||
if(!empty($don))
|
||||
$this->valeur[$key] = $don;
|
||||
|
@ -86,7 +86,7 @@ $(document).ready(function(){
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
$('#textarea_adr_dept').val(terms.join( "," )+$('#textarea_adr_dept').val());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user