Correction de condition fausse
This commit is contained in:
parent
b3d5967058
commit
3bfc072fb2
@ -249,23 +249,25 @@ Class Fields
|
||||
'teff_etab' => array(
|
||||
'label' => 'Tranche d\'effectif de l\'etablissement',
|
||||
'fields' => array(
|
||||
'intervalSelect' => array('value' => array(
|
||||
array('0', '0'),
|
||||
array('0', '1'),
|
||||
array('1', '2'),
|
||||
array('2', '3'),
|
||||
array('3', '11'),
|
||||
array('11', '12'),
|
||||
array('12', '21'),
|
||||
array('21', '22'),
|
||||
array('22', '31'),
|
||||
array('31', '32'),
|
||||
array('32', '41'),
|
||||
array('41', '42'),
|
||||
array('42', '51'),
|
||||
array('51', '52'),
|
||||
array('52', '53')
|
||||
))
|
||||
'intervalSelect' => array(
|
||||
'value' => array(
|
||||
array('0', '0'),
|
||||
array('0', '1'),
|
||||
array('1', '2'),
|
||||
array('2', '3'),
|
||||
array('3', '11'),
|
||||
array('11', '12'),
|
||||
array('12', '21'),
|
||||
array('21', '22'),
|
||||
array('22', '31'),
|
||||
array('31', '32'),
|
||||
array('32', '41'),
|
||||
array('41', '42'),
|
||||
array('42', '51'),
|
||||
array('51', '52'),
|
||||
array('52', '53')
|
||||
)
|
||||
)
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
@ -331,18 +333,9 @@ Class Fields
|
||||
'famille' => 'geographique',
|
||||
'activated' => true,
|
||||
'type' => 'textarea',
|
||||
'class' => null
|
||||
),
|
||||
'adr_dep' => array(
|
||||
'label' => 'Département',
|
||||
'fields' => array(
|
||||
'text' => array('value' => null),
|
||||
'textarea' => array('value' => null)
|
||||
),
|
||||
'famille' => 'geographique',
|
||||
'activated' => true,
|
||||
'type' => 'textarea',
|
||||
'class' => null
|
||||
'class' => null,
|
||||
'action' => 'geographique',
|
||||
'title' => 'Localisation'
|
||||
),
|
||||
'adr_com' => array(
|
||||
'label' => 'Code commune Insee',
|
||||
@ -613,7 +606,7 @@ Class Fields
|
||||
public function getValues()
|
||||
{
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
$session = new SessionCiblage();
|
||||
$values = array();
|
||||
|
||||
foreach($session->getCriteres() as $key => $item)
|
||||
@ -639,14 +632,51 @@ Class Fields
|
||||
switch($name)
|
||||
{
|
||||
case 'ape_etab' :
|
||||
case 'ape_entrep' :
|
||||
$nafs = explode(',', $valeur);
|
||||
foreach($nafs as $naf)
|
||||
$values = array_merge($values, $this->nafArbo($name, $naf));
|
||||
break;
|
||||
case 'adr_cp':
|
||||
$valeurs = explode(',', $valeur);
|
||||
foreach($valeurs as $element) {
|
||||
$array = $this->deptArbo($name, $element);
|
||||
if(!empty($array))
|
||||
$values = array_merge($values, $array);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ($values);
|
||||
}
|
||||
|
||||
protected function deptArbo($name, $valeur)
|
||||
{
|
||||
if(strlen($valeur) < 5){
|
||||
if($valeur[0] == 'D') {
|
||||
$table = new Application_Model_Codepostaux();
|
||||
$sql = $table->select()->where('Codepos LIKE "'.$valeur.'%"');
|
||||
$codes = $table->fetchAll($sql)->toArray();
|
||||
foreach($codes as $code) {
|
||||
$values[] = $code['Codepos'];
|
||||
}
|
||||
} else if($valeur[0] == 'R') {
|
||||
$table = new Application_Model_Departements();
|
||||
$sql = $table->select()->from('departements', array('numdep'))->where('codeRegionInsee = ?', substr($valeur, 1));
|
||||
$results = $table->fetchAll($sql)->toArray();
|
||||
foreach($results as $result) {
|
||||
$table = new Application_Model_Codepostaux();
|
||||
$sql = $table->select()->from('codepostaux', array('Codepos'))->where('Codepos LIKE "'.$result['numdep'].'%"');
|
||||
$codes = $table->fetchAll($sql)->toArray();
|
||||
foreach($codes as $code) {
|
||||
$values[] = $code['Codepos'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return ($values);
|
||||
}
|
||||
return (array($valeur));
|
||||
}
|
||||
|
||||
protected function nafArbo($key, $valeur)
|
||||
{
|
||||
$value = array();
|
||||
|
Loading…
Reference in New Issue
Block a user