issue #0001477 : Ajout nouveau champs code départements
This commit is contained in:
parent
fbaa25862e
commit
e986fc30f1
@ -9,11 +9,11 @@ class FieldsController extends Zend_Controller_Action
|
||||
$this->view->headScript()
|
||||
->appendFile('/libs/tree/jquery.jstree.js', 'text/javascript')
|
||||
->appendFile('/themes/default/scripts/fields.js', 'text/javascript');
|
||||
|
||||
|
||||
$field = new Scores_Fields();
|
||||
$this->view->fields = $field;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset criteres by family
|
||||
*/
|
||||
@ -21,7 +21,7 @@ class FieldsController extends Zend_Controller_Action
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$family = $request->getParam('family');
|
||||
if ( !empty($family) )
|
||||
@ -30,7 +30,7 @@ class FieldsController extends Zend_Controller_Action
|
||||
$fields->resetFamille($family);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manage autocomplete
|
||||
*/
|
||||
@ -40,9 +40,9 @@ class FieldsController extends Zend_Controller_Action
|
||||
$request = $this->getRequest();
|
||||
$name = $request->getParam('name');
|
||||
$q = strtolower($request->getParam('q'));
|
||||
|
||||
|
||||
$output = array();
|
||||
|
||||
|
||||
switch ($name) {
|
||||
case 'ape_etab':
|
||||
case 'ape_entrep':
|
||||
@ -70,7 +70,7 @@ class FieldsController extends Zend_Controller_Action
|
||||
$sql->where("LOWER(lib) ".$where);
|
||||
}
|
||||
$sql->where('niveau = 5');
|
||||
|
||||
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
@ -80,13 +80,13 @@ class FieldsController extends Zend_Controller_Action
|
||||
}
|
||||
break;
|
||||
case 'geo':
|
||||
|
||||
|
||||
//Replace characters ' and - in space
|
||||
$q = preg_replace("/['-]/", ' ', $q);
|
||||
|
||||
|
||||
//Remove characters
|
||||
$q = preg_replace("/^[a-z]\s/i", '', $q);
|
||||
|
||||
|
||||
//Detect if we have string
|
||||
if ( preg_match("/[a-zA-Z]+/", $q) )
|
||||
{
|
||||
@ -118,7 +118,7 @@ class FieldsController extends Zend_Controller_Action
|
||||
'value' => 'R'.$item->REGION
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//Département
|
||||
$table = new Application_Model_Departements();
|
||||
$sql = $table->select();
|
||||
@ -145,7 +145,7 @@ class FieldsController extends Zend_Controller_Action
|
||||
'value' => 'D'.$item->numdep
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//Ville
|
||||
$table = new Application_Model_CodePostaux();
|
||||
$sql = $table->select();
|
||||
@ -172,9 +172,22 @@ class FieldsController extends Zend_Controller_Action
|
||||
'value' => 'C'.$item->INSEE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
} elseif ( preg_match('/[0-9]{1,5}/', $q) ) {
|
||||
|
||||
|
||||
//Code Département
|
||||
if (strlen($q)==2) {
|
||||
$table = new Application_Model_Departements();
|
||||
$sql = $table->select()->where('numdep=?', $q);
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->libdep . ' (Département)',
|
||||
'value' => 'D'.$item->numdep
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//Code Postal
|
||||
$table = new Application_Model_CodePostaux();
|
||||
$sql = $table->select()->where('Codepos LIKE "'.$q.'%"');
|
||||
@ -185,15 +198,15 @@ class FieldsController extends Zend_Controller_Action
|
||||
'value' => 'C'.$item->INSEE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'cj':
|
||||
$table = new Application_Model_FormeJuridique();
|
||||
$separator = ' , ';
|
||||
$sql = $table->select();
|
||||
|
||||
|
||||
$queries = explode(' ', $q);
|
||||
if (count($queries)>0) {
|
||||
$where = '';
|
||||
@ -227,7 +240,7 @@ class FieldsController extends Zend_Controller_Action
|
||||
}
|
||||
$this->view->assign('output', $output);
|
||||
}
|
||||
|
||||
|
||||
public function checkvalue(){}
|
||||
|
||||
|
||||
}
|
@ -60,6 +60,7 @@
|
||||
<?=$this->Field('geo_etranger')?>
|
||||
<?=$this->Field('geo_corse')?>
|
||||
</li>
|
||||
<li class="advanced"><?=$this->Field('codesdepts')?></li>
|
||||
<li class="advanced"><?=$this->Field('codespostaux')?></li>
|
||||
<li class="advanced"><?=$this->Field('codesinsee')?></li>
|
||||
<li><?=$this->Field('zus')?></li>
|
||||
|
Loading…
Reference in New Issue
Block a user