Issue #0001873: [liens inter-entreprises] Utiliser les codes Voies défini par l'INSEE pour standardiser les adresses

This commit is contained in:
Aram HARUTYUNYAN 2014-03-04 08:16:20 +00:00
parent 6776e6dcad
commit 176df57c98
5 changed files with 271 additions and 11 deletions

View File

@ -47,6 +47,205 @@ class SaisieController extends Zend_Controller_Action
array( "triId"=>"1790", "triCode"=>"CAYENL", "triNom"=>"Chambre Détachée de la Cour d'Appel de Fort de France à Cayenne", "triCP"=>"97300" ),
array( "triId"=>"1798", "triCode"=>"AGENL", "triNom"=>"Cour d'Appel d'Agen", "triCP"=>"47916" ),
);
protected $codVoie = array(
'ABE' => "Abbaye",
'AGL' => "Agglomération",
'AIRE' => "Aire",
'ALL' => "Allée",
'ALL' => "Allee",
'ACH' => "Ancien chemin",
'ART' => "Ancienne route",
'ANSE' => "Anse",
'ARC' => "Arcade",
'AUT' => "Autoroute",
'AV' => "Avenue",
'BRE' => "Barrière",
'BCH' => "Bas chemin",
'BSTD' => "Bastide",
'BAST' => "Baston",
'BEGI' => "Beguinage",
'BER' => "Berge",
'BOIS' => "Bois",
'BCLE' => "Boucle",
'BD' => "Boulevard",
'BRG' => "Bourg",
'BUT' => "Butte",
'CALE' => "Cale",
'CAMP' => "Camp",
'CGNE' => "Campagne",
'CPG' => "Camping",
'CARR' => "Carré",
'CAU' => "Carreau",
'CAR' => "Carrefour",
'CARE' => "Carrière",
'CST' => "Castel",
'CAV' => "Cavée",
'CTRE' => "Central",
'CTRE' => "Centre",
'CHL' => "Chalet",
'CHP' => "Chapelle",
'CHI' => "Charmille",
'CHT' => "Château",
'CHS' => "Chaussée",
'CHE' => "Chemin",
'CHV' => "Chemin vicinaux",
'CHV' => "Chemin vicinal",
'CHEM' => "Cheminement",
'CITE' => "Cîte",
'CLOI' => "Cloître",
'CLOS' => "Clos",
'COL' => "Col",
'COLI' => "Colline",
'CTR' => "Contour",
'COR' => "Corniche",
'COTE' => "Côte",
'COTT' => "Cottage",
'COUR' => "Cour",
'CRS' => "Cours",
'DARS' => "Darse",
'DEG' => "Degré",
'DSG' => "Descente",
'DSC' => "Descente",
'DIG' => "Digue",
'DOM' => "Domaine",
'ECA' => "Ecart",
'ECL' => "Ecluse",
'EGL' => "Eglise",
'EN' => "Enceinte",
'ENV' => "Enclave",
'ENC' => "Enclos",
'ESC' => "Escalier",
'ESPA' => "Espace",
'ESP' => "Esplanade",
'ETING' => "Etang",
'FG' => "Faubourg",
'FRM' => "Ferme",
'FON' => "Fontaine",
'FORT' => "Fort",
'FORM' => "Forum",
'FOS' => "Fosse",
'FOYR' => "Foyer",
'GAL' => "Galerie",
'GARE' => "Gare",
'GARN' => "Garenne",
'GBD' => "Grand boulevard",
'GDEN' => "Grande ensemble",
'GR' => "Grande rue",
'GRI' => "Grille",
'GRIM' => "Grimpette",
'GPE' => "Groupe",
'GPT' => "Groupement",
'HLE' => "Halle",
'HAM' => "Hameau",
'HCH' => "Haut chemin",
'HIP' => "Hippodrome",
'HLM' => "HLM",
'ILE' => "Ile",
'IMM' => "Immeuble",
'IMP' => "Impasse",
'JARD' => "Jardin",
'JTE' => "Jetée",
'LEVE' => "Levée",
'LD' => "Lieu dit",
'LD' => "Lieudit",
'LOT' => "Lotissement",
'MAIL' => "Mail",
'MF' => "Maison forestière",
'MAN' => "Manoir",
'MAR' => "Marche",
'MAS' => "Mas",
'MET' => "Métro",
'MTE' => "Montée",
'MLN' => "Moulin",
'MUS' => "Musée",
'NTE' => "Nouvelle route",
'PAL' => "Palais",
'PARC' => "Parc",
'PKG' => "Parking",
'PRV' => "Parvis",
'PAS' => "Passage",
'PN' => "Passage à niveau",
'PASS' => "Passe",
'PLE' => "Passerelle",
'PAT' => "Patio",
'PAV' => "Pavillon",
'PERI' => "Périphérique",
'PSTY' => "Péristyle",
'PTA' => "Petites allée",
'PCH' => "Petit chemin",
'PAE' => "Petite avenue",
'PIM' => "Petite impasse",
'PRT' => "Petite route",
'PTR' => "Petite rue",
'PL' => "Place",
'PLCI' => "Placis",
'PLAG' => "Plage",
'PLN' => "Plaine",
'PLAN' => "Plan",
'PLT' => "Plateau",
'PNT' => "Pointe",
'PONT' => "Pont",
'PCH' => "Porche",
'PORT' => "Port",
'PTE' => "Porte",
'PORQ' => "Portique",
'POT' => "Poterne",
'POUR' => "Pourtour",
'PRE' => "Pré",
'PRQ' => "Presqu'île",
'PROM' => "Promenade",
'QU' => "Quai",
'QUAI' => "Quai",
'QUA' => "Quartier",
'RAC' => "Raccourci",
'RAID' => "Raidillon",
'RPE' => "Rampe",
'REM' => "Rempart",
'RES' => "Résidence",
'ROC' => "Roc",
'ROC' => "Rocade",
'RPT' => "Rond point",
'ROQT' => "Roquet",
'RTD' => "Rotonde",
'RTE' => "Route",
'R' => "Rue",
'RUE' => "Rue",
'RLE' => "Ruelle",
'SEN' => "Sente",
'SEN' => "Sentier",
'SQ' => "Square",
'STDE' => "Stade",
'STA' => "Station",
'TPL' => "Terre plein",
'TRN' => "Terrain",
'TSSE' => "Terrasse",
'TRT' => "Tertre",
'TOUR' => "Tour",
'TRA' => "Traverse",
'VAL' => "Vallon",
'VAL' => "Vallée",
'VEN' => "Venelle",
'VIA' => "Via",
'VTE' => "Vieille route",
'VCHE' => "Vieux chemin",
'VLA' => "Villa",
'VGE' => "Village",
'VLGE' => "Village",
'VOI' => "Voie",
'VOIE' => "Voie",
'ZONE' => "Zone",
'ZAC' => "Zone d'aménagement concerté",
'Z A C' => "Zone d'aménagement concerté",
'ZAD' => "Zone d'aménagement différé",
'Z A D' => "Zone d'aménagement différé",
'ZA' => "Zone artisanale",
'Z A' => "Zone artisanale",
'ZI' => "Zone industrielle",
'Z I' => "Zone industrielle",
'ZUP' => "Zone à urbaniser en priorité",
'Z U P' => "Zone à urbaniser en priorité",
);
/**
* Retourne Fonctions de direction
@ -2286,6 +2485,26 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('output', $output);
}
public function codvoieAction()
{
$this->_helper->layout()->disableLayout();
$codvoie = $this->getRequest()->getParam('codvoie', null);
$output = array();
if ( null !== $codvoie) {
foreach($this->codVoie as $key=>$val){
if (stripos($key, $codvoie)!==false || stripos($val, $codvoie)!==false){
$output[] = array(
'label' => $key.": ".$val,
'value' => $key
);
}
}
}
$this->view->assign('output', $output);
}
/**
* Edit contact information

View File

@ -0,0 +1 @@
<?=json_encode($this->output)?>

View File

@ -312,6 +312,20 @@ $('a#google').on('click', function(e){
window.open('https://www.google.fr/#q='+encodeURIComponent(val));
});
$('input[name=adresse_codvoie]').autocomplete({
minLength: 2,
delay: 250,
source: function(request, response) {
var codvoie = $('input[name=adresse_codvoie]').val();
$.getJSON('<?=$this->url(array('controller'=>'saisie','action'=>'codvoie'),null,true)?>', { codvoie: codvoie },
function(data) { response(data); }
);
},
select: function( event, ui ) {
$('input[name=adresse_codvoie]').attr('value', ui.item.value);
}
});
$(document).ready(function(){
var code = $('select[name=adresse_pays]').val();
$('span#indTel').text('+'+countries[code]['indTel']);

View File

@ -195,7 +195,7 @@ $('input[name=isin]').change(function(e){
});
});
function cpville(inputFld, outputFld, countrySel=null, countryVal=null) {
function cpville(inputFld, outputFld, countrySel, countryVal) {
$('input[name='+inputFld+']').autocomplete({
minLength: 4,
delay: 250,
@ -207,20 +207,33 @@ function cpville(inputFld, outputFld, countrySel=null, countryVal=null) {
},
select: function( event, ui ) {
var text = ui.item.label;
text = text.replace(ui.item.value+': ','');
text = text.replace(ui.item.value+': ','');
if (inputFld==outputFld) {
ui.item.value = text;
}
$('input[name='+inputFld+']').attr('value', ui.item.value);
$('input[name='+outputFld+']').attr('value', text);
$('input[name='+outputFld+']').attr('value', text);
if (countrySel!=null && countryVal!=null){
$('select[name='+countrySel+']').val(countryVal);
}
}
})
});
}
cpville('adresse_cp', 'adresse_ville');
$('input[name=adresse_codvoie]').autocomplete({
minLength: 2,
delay: 250,
source: function(request, response) {
var codvoie = $('input[name=adresse_codvoie]').val();
$.getJSON('<?=$this->url(array('controller'=>'saisie','action'=>'codvoie'),null,true)?>', { codvoie: codvoie },
function(data) { response(data); }
);
},
select: function( event, ui ) {
$('input[name=adresse_codvoie]').attr('value', ui.item.value);
}
});
</script>
<?php } else {?>

View File

@ -93,7 +93,7 @@ $('input[name=naissance_date]').datepicker({ changeMonth: true, changeYear: true
</div>
<script>
function cpville(inputFld, outputFld, countrySel=null, countryVal=null) {
function cpville(inputFld, outputFld, countrySel, countryVal) {
$('input[name='+inputFld+']').autocomplete({
minLength: 4,
delay: 250,
@ -105,21 +105,34 @@ function cpville(inputFld, outputFld, countrySel=null, countryVal=null) {
},
select: function( event, ui ) {
var text = ui.item.label;
text = text.replace(ui.item.value+': ','');
text = text.replace(ui.item.value+': ','');
if (inputFld==outputFld) {
ui.item.value = text;
}
$('input[name='+inputFld+']').attr('value', ui.item.value);
$('input[name='+outputFld+']').attr('value', text);
$('input[name='+outputFld+']').attr('value', text);
if (countrySel!=null && countryVal!=null){
$('select[name='+countrySel+']').val(countryVal);
$('select[name='+countrySel+']').val(countryVal);
}
}
})
});
}
cpville('adresse_cp', 'adresse_ville', 'adresse_pays', 'FRA');
cpville('naissance_lieu', 'naissance_lieu', 'naissance_dept_pays', 'FRA');
$('input[name=adresse_codvoie]').autocomplete({
minLength: 2,
delay: 250,
source: function(request, response) {
var codvoie = $('input[name=adresse_codvoie]').val();
$.getJSON('<?=$this->url(array('controller'=>'saisie','action'=>'codvoie'),null,true)?>', { codvoie: codvoie },
function(data) { response(data); }
);
},
select: function( event, ui ) {
$('input[name=adresse_codvoie]').attr('value', ui.item.value);
}
});
</script>
<div class="fieldgrp">