diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index f63be99ff32..cfbaaee8d6c 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -934,7 +934,7 @@ class Adherent extends CommonObject
{
global $conf, $langs;
- $sql = "SELECT d.rowid, d.civilite, d.prenom as firstname, d.nom as name, d.societe, d.fk_soc, d.statut, d.public, d.adresse, d.cp, d.ville, d.note,";
+ $sql = "SELECT d.rowid, d.civilite, d.prenom as firstname, d.nom as name, d.societe, d.fk_soc, d.statut, d.public, d.adresse as address, d.cp as zip, d.ville as town, d.note,";
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
$sql.= " d.photo, d.fk_adherent_type, d.morphy,";
$sql.= " d.datec as datec,";
@@ -977,12 +977,12 @@ class Adherent extends CommonObject
$this->pass = $obj->pass;
$this->societe = $obj->societe;
$this->fk_soc = $obj->fk_soc;
- $this->adresse = $obj->adresse; // TODO deprecated
- $this->cp = $obj->cp; // TODO deprecated
- $this->ville = $obj->ville; // TODO deprecated
- $this->address = $obj->adresse;
- $this->zip = $obj->cp;
- $this->town = $obj->ville;
+ $this->adresse = $obj->address; // TODO deprecated
+ $this->address = $obj->address;
+ $this->cp = $obj->zip; // TODO deprecated
+ $this->zip = $obj->zip;
+ $this->ville = $obj->town; // TODO deprecated
+ $this->town = $obj->town;
$this->fk_departement = $obj->fk_departement;
$this->departement_code = $obj->fk_departement?$obj->departement_code:'';
@@ -1959,8 +1959,11 @@ class Adherent extends CommonObject
$this->pass='dolibspec';
$this->societe = 'Societe ABC';
$this->adresse = '61 jump street';
+ $this->address = '61 jump street';
$this->cp = '75000';
+ $this->zip = '75000';
$this->ville = 'Paris';
+ $this->town = 'Paris';
$this->pays_id = 1;
$this->pays_code = 'FR';
$this->pays = 'France';
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 03a9b173e71..8dc6235ebc4 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -222,12 +222,15 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->adhe
$adh->pass = trim($_POST["pass"]);
$adh->societe = trim($_POST["societe"]);
- $adh->adresse = trim($_POST["adresse"]);
- $adh->cp = trim($_POST["cp"]);
- $adh->ville = trim($_POST["ville"]);
+ $adh->adresse = trim($_POST["address"]); // deprecated
+ $adh->address = trim($_POST["address"]);
+ $adh->cp = trim($_POST["zipcode"]); // deprecated
+ $adh->zip = trim($_POST["zipcode"]);
+ $adh->ville = trim($_POST["town"]); // deprecated
+ $adh->town = trim($_POST["town"]);
$adh->fk_departement = $_POST["departement_id"];
- $adh->pays_id = $_POST["pays"];
+ $adh->pays_id = $_POST["pays_id"];
$adh->phone = trim($_POST["phone"]);
$adh->phone_perso = trim($_POST["phone_perso"]);
@@ -332,9 +335,9 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer)
$nom=$_POST["nom"];
$prenom=$_POST["prenom"];
$societe=$_POST["societe"];
- $adresse=$_POST["adresse"];
- $cp=$_POST["cp"];
- $ville=$_POST["ville"];
+ $address=$_POST["address"];
+ $zip=$_POST["zipcode"];
+ $town=$_POST["town"];
$departement_id=$_POST["departement_id"];
$pays_id=$_POST["pays_id"];
@@ -357,10 +360,13 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer)
$adh->prenom = $prenom;
$adh->nom = $nom;
$adh->societe = $societe;
- $adh->adresse = $adresse;
- $adh->cp = $cp;
- $adh->ville = $ville;
- $adh->fk_departement = $departement_id;
+ $adh->adresse = $address; // deprecated
+ $adh->address = $address;
+ $adh->cp = $zip; // deprecated
+ $adh->zip = $zip;
+ $adh->ville = $town; // deprecated
+ $adh->town = $town;
+ $adh->fk_departement = $departement_id;
$adh->pays_id = $pays_id;
$adh->phone = $phone;
$adh->phone_perso = $phone_perso;
@@ -680,29 +686,37 @@ if ($action == 'create')
// Address
print '
'.$langs->trans("Address").' ';
- print ' ';
+ print '';
+ print '';
// Zip / Town
- print ''.$langs->trans("Zip").' / '.$langs->trans("Town").' cp).'"> ville).'"> ';
+ print ''.$langs->trans("Zip").' / '.$langs->trans("Town").' ';
+ print $htmlcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$adh->zip),'zipcode',array('town','selectpays_id','departement_id'),6);
+ print ' ';
+ print $htmlcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$adh->town),'town',array('zipcode','selectpays_id','departement_id'));
+ print ' ';
// Country
$adh->pays_id=$adh->pays_id?$adh->pays_id:$mysoc->pays_id;
- print ''.$langs->trans("Country").' ';
+ print ' '.$langs->trans('Country').' ';
$html->select_pays(isset($_POST["pays_id"])?$_POST["pays_id"]:$adh->pays_id,'pays_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print ' ';
// State
- print ''.$langs->trans('State').' ';
- if ($adh->pays_id)
+ if (empty($conf->global->MEMBER_DISABLE_STATE))
{
- $htmlcompany->select_departement(isset($_POST["departement_id"])?$_POST["departement_id"]:$adh->fk_departement,$adh->pays_code);
+ print ' '.$langs->trans('State').' ';
+ if ($adh->pays_id)
+ {
+ $htmlcompany->select_departement(isset($_POST["departement_id"])?$_POST["departement_id"]:$adh->fk_departement,$adh->pays_code);
+ }
+ else
+ {
+ print $countrynotdefined;
+ }
+ print ' ';
}
- else
- {
- print $countrynotdefined;
- }
- print '';
// Tel pro
print ''.$langs->trans("PhonePro").' phone).'"> ';
@@ -891,21 +905,30 @@ if ($action == 'edit')
// Address
print ''.$langs->trans("Address").' ';
- print ' ';
-
- // Zip / Town
- print ''.$langs->trans("Zip").'/'.$langs->trans("Town").' cp).'"> ville).'"> ';
-
- // Country
- print ''.$langs->trans("Country").' ';
- $html->select_pays(isset($_POST["pays"])?$_POST["pays"]:$adh->pays_id,'pays');
- if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
+ print '';
print ' ';
- // State
- print ''.$langs->trans('State').' ';
- $htmlcompany->select_departement($adh->fk_departement,$adh->pays_code);
- print ' ';
+ // Zip / Town
+ print ''.$langs->trans("Zip").' / '.$langs->trans("Town").' ';
+ print $htmlcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$adh->zip),'zipcode',array('town','selectpays_id','departement_id'),6);
+ print ' ';
+ print $htmlcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$adh->town),'town',array('zipcode','selectpays_id','departement_id'));
+ print ' ';
+
+ // Country
+ $adh->pays_id=$adh->pays_id?$adh->pays_id:$mysoc->pays_id;
+ print ''.$langs->trans('Country').' ';
+ $html->select_pays(isset($_POST["pays_id"])?$_POST["pays_id"]:$adh->pays_id,'pays_id');
+ if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
+ print ' ';
+
+ // State
+ if (empty($conf->global->MEMBER_DISABLE_STATE))
+ {
+ print ''.$langs->trans('State').' ';
+ $htmlcompany->select_departement($adh->fk_departement,$adh->pays_code);
+ print ' ';
+ }
// Tel
print ''.$langs->trans("PhonePro").' phone).'"> ';
@@ -1194,11 +1217,11 @@ if ($rowid && $action != 'edit')
// Address
print ''.$langs->trans("Address").' ';
- dol_print_address($adh->adresse,'gmap','member',$adh->id);
+ dol_print_address($adh->address,'gmap','member',$adh->id);
print ' ';
// Zip / Town
- print ''.$langs->trans("Zip").' / '.$langs->trans("Town").' '.$adh->cp.' '.$adh->ville.' ';
+ print ''.$langs->trans("Zip").' / '.$langs->trans("Town").' '.$adh->zip.' '.$adh->town.' ';
// Country
print ''.$langs->trans("Country").' ';
diff --git a/htdocs/core/ajaxziptown.php b/htdocs/core/ajaxziptown.php
index b859c222b79..5c585292ab7 100644
--- a/htdocs/core/ajaxziptown.php
+++ b/htdocs/core/ajaxziptown.php
@@ -1,6 +1,6 @@
- * Copyright (C) 201 Laurent Destailleur
+/* Copyright (C) 2010 Regis Houssin
+ * Copyright (C) 2011 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by