Correction de condition fausse
This commit is contained in:
parent
b3d5967058
commit
3bfc072fb2
@ -249,23 +249,25 @@ Class Fields
|
|||||||
'teff_etab' => array(
|
'teff_etab' => array(
|
||||||
'label' => 'Tranche d\'effectif de l\'etablissement',
|
'label' => 'Tranche d\'effectif de l\'etablissement',
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'intervalSelect' => array('value' => array(
|
'intervalSelect' => array(
|
||||||
array('0', '0'),
|
'value' => array(
|
||||||
array('0', '1'),
|
array('0', '0'),
|
||||||
array('1', '2'),
|
array('0', '1'),
|
||||||
array('2', '3'),
|
array('1', '2'),
|
||||||
array('3', '11'),
|
array('2', '3'),
|
||||||
array('11', '12'),
|
array('3', '11'),
|
||||||
array('12', '21'),
|
array('11', '12'),
|
||||||
array('21', '22'),
|
array('12', '21'),
|
||||||
array('22', '31'),
|
array('21', '22'),
|
||||||
array('31', '32'),
|
array('22', '31'),
|
||||||
array('32', '41'),
|
array('31', '32'),
|
||||||
array('41', '42'),
|
array('32', '41'),
|
||||||
array('42', '51'),
|
array('41', '42'),
|
||||||
array('51', '52'),
|
array('42', '51'),
|
||||||
array('52', '53')
|
array('51', '52'),
|
||||||
))
|
array('52', '53')
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
'famille' => 'economique',
|
'famille' => 'economique',
|
||||||
'activated' => true,
|
'activated' => true,
|
||||||
@ -331,18 +333,9 @@ Class Fields
|
|||||||
'famille' => 'geographique',
|
'famille' => 'geographique',
|
||||||
'activated' => true,
|
'activated' => true,
|
||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'class' => null
|
'class' => null,
|
||||||
),
|
'action' => 'geographique',
|
||||||
'adr_dep' => array(
|
'title' => 'Localisation'
|
||||||
'label' => 'Département',
|
|
||||||
'fields' => array(
|
|
||||||
'text' => array('value' => null),
|
|
||||||
'textarea' => array('value' => null)
|
|
||||||
),
|
|
||||||
'famille' => 'geographique',
|
|
||||||
'activated' => true,
|
|
||||||
'type' => 'textarea',
|
|
||||||
'class' => null
|
|
||||||
),
|
),
|
||||||
'adr_com' => array(
|
'adr_com' => array(
|
||||||
'label' => 'Code commune Insee',
|
'label' => 'Code commune Insee',
|
||||||
@ -613,7 +606,7 @@ Class Fields
|
|||||||
public function getValues()
|
public function getValues()
|
||||||
{
|
{
|
||||||
require_once 'Scores/SessionCiblage.php';
|
require_once 'Scores/SessionCiblage.php';
|
||||||
$session = new SessionCiblage();
|
$session = new SessionCiblage();
|
||||||
$values = array();
|
$values = array();
|
||||||
|
|
||||||
foreach($session->getCriteres() as $key => $item)
|
foreach($session->getCriteres() as $key => $item)
|
||||||
@ -639,14 +632,51 @@ Class Fields
|
|||||||
switch($name)
|
switch($name)
|
||||||
{
|
{
|
||||||
case 'ape_etab' :
|
case 'ape_etab' :
|
||||||
|
case 'ape_entrep' :
|
||||||
$nafs = explode(',', $valeur);
|
$nafs = explode(',', $valeur);
|
||||||
foreach($nafs as $naf)
|
foreach($nafs as $naf)
|
||||||
$values = array_merge($values, $this->nafArbo($name, $naf));
|
$values = array_merge($values, $this->nafArbo($name, $naf));
|
||||||
break;
|
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);
|
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)
|
protected function nafArbo($key, $valeur)
|
||||||
{
|
{
|
||||||
$value = array();
|
$value = array();
|
||||||
|
Loading…
Reference in New Issue
Block a user