issue #0001407 : Ajout recherche forme juridique
This commit is contained in:
parent
3a8d708551
commit
ca6b1383bd
@ -430,6 +430,7 @@ class RechercheController extends Zend_Controller_Action
|
||||
$criteres['telFax'] = $telFax;
|
||||
$criteres['naf'] = $naf;
|
||||
$criteres['siege'] = false;
|
||||
$criteres['fj'] = $params['fj'];
|
||||
|
||||
//Affichage du filtre actif/inactif
|
||||
$filtres = array(
|
||||
@ -801,17 +802,15 @@ class RechercheController extends Zend_Controller_Action
|
||||
$queries = explode(' ', $q);
|
||||
if (count($queries)>0) {
|
||||
$where = '';
|
||||
$i = 0;
|
||||
foreach ($queries as $item) {
|
||||
$i++;
|
||||
if (empty($where)) {
|
||||
$op = 'LIKE ';
|
||||
} elseif ($i < count($queries)) {
|
||||
$op = ' OR ';
|
||||
}
|
||||
if (strlen($item)>2) {
|
||||
$where.= $op.'"%'.strtolower($item).'%"';
|
||||
}
|
||||
if (empty($where)) {
|
||||
$op = 'LIKE ';
|
||||
} else {
|
||||
$op = ' OR ';
|
||||
}
|
||||
$where.= $op.'"%'.strtolower($item).'%"';
|
||||
}
|
||||
}
|
||||
$sql->where("LOWER(libNaf5) ".$where);
|
||||
}
|
||||
@ -835,6 +834,54 @@ class RechercheController extends Zend_Controller_Action
|
||||
$this->view->assign('output', $output);
|
||||
}
|
||||
|
||||
public function fjAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$q = strtolower($this->getRequest()->getParam('q', null));
|
||||
$output = array();
|
||||
|
||||
if ( null !== $q ) {
|
||||
$table = new Application_Model_TabFJur();
|
||||
$sql = $table->select('code, libelle');
|
||||
$sql->where('LENGTH(code)=4');
|
||||
if ( is_numeric(substr($q,0,4)) ) {
|
||||
$sql->where("code LIKE '%".$q."%'");
|
||||
} else {
|
||||
$queries = explode(' ', $q);
|
||||
if (count($queries)>0) {
|
||||
$where = '';
|
||||
foreach ($queries as $item) {
|
||||
if (strlen($item)>2) {
|
||||
if (empty($where)) {
|
||||
$op = 'LIKE ';
|
||||
} else {
|
||||
$op = ' OR ';
|
||||
}
|
||||
$where.= $op.'"%'.strtolower($item).'%"';
|
||||
}
|
||||
}
|
||||
$sql->where("LOWER(libelle) ".$where);
|
||||
}
|
||||
}
|
||||
Zend_Registry::get('firebug')->info($where);
|
||||
|
||||
$rows = $table->fetchAll($sql);
|
||||
if ( count($rows)>0 ) {
|
||||
$separator = " , ";
|
||||
foreach ($rows as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->code . $separator . $item->libelle,
|
||||
'value' => $item->code,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->assign('output', $output);
|
||||
}
|
||||
|
||||
|
||||
public function refclientAction()
|
||||
{
|
||||
|
||||
@ -1035,6 +1082,7 @@ class RechercheController extends Zend_Controller_Action
|
||||
$criteres['telFax'] = $telFax;
|
||||
$criteres['naf'] = $naf;
|
||||
$criteres['siege'] = false;
|
||||
$criteres['fj'] = $fj;
|
||||
|
||||
$request = $this->getRequest();
|
||||
$filtre = $request->getParam('filtre', 'tout');
|
||||
|
6
application/models/TabFJur.php
Normal file
6
application/models/TabFJur.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_TabFJur extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'tabFJur';
|
||||
}
|
||||
|
@ -41,6 +41,9 @@ $form = $this->form;
|
||||
<?=$form->naf?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<?=$form->fj?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<?=$form->pays?>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
1
application/views/default/scripts/recherche/fj.phtml
Normal file
1
application/views/default/scripts/recherche/fj.phtml
Normal file
@ -0,0 +1 @@
|
||||
<?=json_encode($this->output)?>
|
@ -152,6 +152,18 @@ class Form_RechercheEntreprise extends Zend_Form
|
||||
),
|
||||
));
|
||||
|
||||
//Forme Juridique
|
||||
$this->addElement('text', 'fj', array(
|
||||
'filters' => array('StringTrim'),
|
||||
'label' => 'Forme Juridique',
|
||||
'required' => 'true',
|
||||
'decorators' => $this->elementDecorators,
|
||||
'attribs' => array(
|
||||
'size' => 30,
|
||||
'maxlength' => 30,
|
||||
),
|
||||
));
|
||||
|
||||
//pays
|
||||
if ($user->checkPerm('INTERNATIONAL')) {
|
||||
$this->addElement('select', 'pays', array(
|
||||
|
@ -157,6 +157,26 @@ class WsScores
|
||||
}
|
||||
}
|
||||
|
||||
public function getCatalogLegalForm($id, $columns)
|
||||
{
|
||||
$params = new stdClass();
|
||||
$params->id = $id;
|
||||
$params->columns =$columns;
|
||||
$client = $this->loadClient('catalog');
|
||||
try {
|
||||
$reponse = $client->getLegalForm($params);
|
||||
return $reponse->getLegalFormResult;
|
||||
} catch (SoapFault $fault) {
|
||||
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
|
||||
return $fault->faultstring;
|
||||
} else {
|
||||
echo $client->__getLastResponse();
|
||||
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setLienChange($action, $idLien, $id)
|
||||
{
|
||||
$params = new stdClass();
|
||||
@ -2325,6 +2345,7 @@ class WsScores
|
||||
$params->criteres->naf = $criteres['naf'];
|
||||
$params->criteres->siege = false;
|
||||
$params->criteres->actif = in_array($criteres['actif'], array(0,1,2)) ? $criteres['actif'] : 2;
|
||||
$params->criteres->fj = $criteres['fj'];
|
||||
$params->position = $position;
|
||||
$params->nbRep = empty($nbRep) ? $this->nbReponses : $nbRep ;
|
||||
$client = $this->loadClient('entreprise');
|
||||
|
@ -37,6 +37,16 @@ $(document).ready(function(){
|
||||
}
|
||||
});
|
||||
|
||||
//Autocomplete sur le champs NAF
|
||||
$('#fj').autocomplete({
|
||||
minLength:3,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/recherche/fj', { q: request.term },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
//Page précédente-suivante
|
||||
$('img.recherchePrec').hover(function() {
|
||||
$(this).attr('src', '/themes/default/images/boutton_precedent_on.gif');
|
||||
|
@ -1,14 +1,7 @@
|
||||
CREATE TABLE IF NOT EXISTS `tabFJur` (
|
||||
`code` int(4) NOT NULL DEFAULT '0',
|
||||
`libelle` varchar(100) DEFAULT NULL COMMENT 'Libellé de la forme juridique',
|
||||
`libelleCourt` varchar(20) NOT NULL,
|
||||
`libelleEn` varchar(100) NOT NULL COMMENT 'Traduction Anglaise',
|
||||
`cjOfficielle` tinyint(1) unsigned NOT NULL COMMENT 'Cette catégorie fait partie des CJ officielles',
|
||||
`public` tinyint(1) unsigned NOT NULL COMMENT 'Catégorie juridique de type relevant de la Fonction Publique',
|
||||
`anneeInsert` year(4) NOT NULL COMMENT 'Année de création de la CJ',
|
||||
`anneeSuppr` year(4) NOT NULL COMMENT 'Année de suppression de la CJ',
|
||||
`notice` text NOT NULL COMMENT 'Information relatives à la forme juridique',
|
||||
`urlInfos` varchar(80) NOT NULL COMMENT 'Liens vers source d''information officielle',
|
||||
PRIMARY KEY (`code`),
|
||||
FULLTEXT KEY `libelle` (`libelle`)
|
||||
) ENGINE=MyISAM COMMENT='Référentiel des Formes Juridiques';
|
@ -37,7 +37,12 @@ $catalogs = array(
|
||||
'sql' => 'tabFctDir.sql',
|
||||
'table' => 'tabFctDir',
|
||||
'method' => array('name'=>'getCatalogFctDir', 'params'=> array( null , array('codeFct', 'libelle') ))
|
||||
)
|
||||
),
|
||||
'fj' => array(
|
||||
'sql' => 'tabFJur.sql',
|
||||
'table' => 'tabFJur',
|
||||
'method' => array('name'=>'getCatalogLegalForm', 'params'=> array( null , array('code', 'libelle', 'libelleEn') ))
|
||||
),
|
||||
);
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user