Skip to content
Snippets Groups Projects
Commit 303f547b authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

New: Autofill town-zip works on foundation module

parent 88dddc3e
Branches
Tags
No related merge requests found
...@@ -934,7 +934,7 @@ class Adherent extends CommonObject ...@@ -934,7 +934,7 @@ class Adherent extends CommonObject
{ {
global $conf, $langs; 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.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
$sql.= " d.photo, d.fk_adherent_type, d.morphy,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy,";
$sql.= " d.datec as datec,"; $sql.= " d.datec as datec,";
...@@ -977,12 +977,12 @@ class Adherent extends CommonObject ...@@ -977,12 +977,12 @@ class Adherent extends CommonObject
$this->pass = $obj->pass; $this->pass = $obj->pass;
$this->societe = $obj->societe; $this->societe = $obj->societe;
$this->fk_soc = $obj->fk_soc; $this->fk_soc = $obj->fk_soc;
$this->adresse = $obj->adresse; // TODO deprecated $this->adresse = $obj->address; // TODO deprecated
$this->cp = $obj->cp; // TODO deprecated $this->address = $obj->address;
$this->ville = $obj->ville; // TODO deprecated $this->cp = $obj->zip; // TODO deprecated
$this->address = $obj->adresse; $this->zip = $obj->zip;
$this->zip = $obj->cp; $this->ville = $obj->town; // TODO deprecated
$this->town = $obj->ville; $this->town = $obj->town;
$this->fk_departement = $obj->fk_departement; $this->fk_departement = $obj->fk_departement;
$this->departement_code = $obj->fk_departement?$obj->departement_code:''; $this->departement_code = $obj->fk_departement?$obj->departement_code:'';
...@@ -1959,8 +1959,11 @@ class Adherent extends CommonObject ...@@ -1959,8 +1959,11 @@ class Adherent extends CommonObject
$this->pass='dolibspec'; $this->pass='dolibspec';
$this->societe = 'Societe ABC'; $this->societe = 'Societe ABC';
$this->adresse = '61 jump street'; $this->adresse = '61 jump street';
$this->address = '61 jump street';
$this->cp = '75000'; $this->cp = '75000';
$this->zip = '75000';
$this->ville = 'Paris'; $this->ville = 'Paris';
$this->town = 'Paris';
$this->pays_id = 1; $this->pays_id = 1;
$this->pays_code = 'FR'; $this->pays_code = 'FR';
$this->pays = 'France'; $this->pays = 'France';
......
...@@ -222,12 +222,15 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->adhe ...@@ -222,12 +222,15 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->adhe
$adh->pass = trim($_POST["pass"]); $adh->pass = trim($_POST["pass"]);
$adh->societe = trim($_POST["societe"]); $adh->societe = trim($_POST["societe"]);
$adh->adresse = trim($_POST["adresse"]); $adh->adresse = trim($_POST["address"]); // deprecated
$adh->cp = trim($_POST["cp"]); $adh->address = trim($_POST["address"]);
$adh->ville = trim($_POST["ville"]); $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->fk_departement = $_POST["departement_id"];
$adh->pays_id = $_POST["pays"]; $adh->pays_id = $_POST["pays_id"];
$adh->phone = trim($_POST["phone"]); $adh->phone = trim($_POST["phone"]);
$adh->phone_perso = trim($_POST["phone_perso"]); $adh->phone_perso = trim($_POST["phone_perso"]);
...@@ -332,9 +335,9 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer) ...@@ -332,9 +335,9 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer)
$nom=$_POST["nom"]; $nom=$_POST["nom"];
$prenom=$_POST["prenom"]; $prenom=$_POST["prenom"];
$societe=$_POST["societe"]; $societe=$_POST["societe"];
$adresse=$_POST["adresse"]; $address=$_POST["address"];
$cp=$_POST["cp"]; $zip=$_POST["zipcode"];
$ville=$_POST["ville"]; $town=$_POST["town"];
$departement_id=$_POST["departement_id"]; $departement_id=$_POST["departement_id"];
$pays_id=$_POST["pays_id"]; $pays_id=$_POST["pays_id"];
...@@ -357,9 +360,12 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer) ...@@ -357,9 +360,12 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer)
$adh->prenom = $prenom; $adh->prenom = $prenom;
$adh->nom = $nom; $adh->nom = $nom;
$adh->societe = $societe; $adh->societe = $societe;
$adh->adresse = $adresse; $adh->adresse = $address; // deprecated
$adh->cp = $cp; $adh->address = $address;
$adh->ville = $ville; $adh->cp = $zip; // deprecated
$adh->zip = $zip;
$adh->ville = $town; // deprecated
$adh->town = $town;
$adh->fk_departement = $departement_id; $adh->fk_departement = $departement_id;
$adh->pays_id = $pays_id; $adh->pays_id = $pays_id;
$adh->phone = $phone; $adh->phone = $phone;
...@@ -680,20 +686,27 @@ if ($action == 'create') ...@@ -680,20 +686,27 @@ if ($action == 'create')
// Address // Address
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>';
print '<textarea name="adresse" wrap="soft" cols="40" rows="2">'.(isset($_POST["adresse"])?$_POST["adresse"]:$adh->adresse).'</textarea></td></tr>'; print '<textarea name="address" wrap="soft" cols="40" rows="2">'.(isset($_POST["address"])?$_POST["address"]:$adh->address).'</textarea>';
print '</td></tr>';
// Zip / Town // Zip / Town
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8" value="'.(isset($_POST["cp"])?$_POST["cp"]:$adh->cp).'"> <input type="text" name="ville" size="32" value="'.(isset($_POST["ville"])?$_POST["ville"]:$adh->ville).'"></td></tr>'; print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
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 '</td></tr>';
// Country // Country
$adh->pays_id=$adh->pays_id?$adh->pays_id:$mysoc->pays_id; $adh->pays_id=$adh->pays_id?$adh->pays_id:$mysoc->pays_id;
print '<tr><td>'.$langs->trans("Country").'</td><td>'; print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
$html->select_pays(isset($_POST["pays_id"])?$_POST["pays_id"]:$adh->pays_id,'pays_id'); $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); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>'; print '</td></tr>';
// State // State
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">'; if (empty($conf->global->MEMBER_DISABLE_STATE))
{
print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($adh->pays_id) if ($adh->pays_id)
{ {
$htmlcompany->select_departement(isset($_POST["departement_id"])?$_POST["departement_id"]:$adh->fk_departement,$adh->pays_code); $htmlcompany->select_departement(isset($_POST["departement_id"])?$_POST["departement_id"]:$adh->fk_departement,$adh->pays_code);
...@@ -703,6 +716,7 @@ if ($action == 'create') ...@@ -703,6 +716,7 @@ if ($action == 'create')
print $countrynotdefined; print $countrynotdefined;
} }
print '</td></tr>'; print '</td></tr>';
}
// Tel pro // Tel pro
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?$_POST["phone"]:$adh->phone).'"></td></tr>'; print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?$_POST["phone"]:$adh->phone).'"></td></tr>';
...@@ -891,21 +905,30 @@ if ($action == 'edit') ...@@ -891,21 +905,30 @@ if ($action == 'edit')
// Address // Address
print '<tr><td>'.$langs->trans("Address").'</td><td>'; print '<tr><td>'.$langs->trans("Address").'</td><td>';
print '<textarea name="adresse" wrap="soft" cols="40" rows="2">'.(isset($_POST["adresse"])?$_POST["adresse"]:$adh->adresse).'</textarea></td></tr>'; print '<textarea name="address" wrap="soft" cols="40" rows="2">'.(isset($_POST["address"])?$_POST["address"]:$adh->address).'</textarea>';
print '</td></tr>';
// Zip / Town // Zip / Town
print '<tr><td>'.$langs->trans("Zip").'/'.$langs->trans("Town").'</td><td><input type="text" name="cp" size="6" value="'.(isset($_POST["cp"])?$_POST["cp"]:$adh->cp).'"> <input type="text" name="ville" size="32" value="'.(isset($_POST["ville"])?$_POST["ville"]:$adh->ville).'"></td></tr>'; print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
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 '</td></tr>';
// Country // Country
print '<tr><td>'.$langs->trans("Country").'</td><td>'; $adh->pays_id=$adh->pays_id?$adh->pays_id:$mysoc->pays_id;
$html->select_pays(isset($_POST["pays"])?$_POST["pays"]:$adh->pays_id,'pays'); print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
$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); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>'; print '</td></tr>';
// State // State
if (empty($conf->global->MEMBER_DISABLE_STATE))
{
print '<tr><td>'.$langs->trans('State').'</td><td>'; print '<tr><td>'.$langs->trans('State').'</td><td>';
$htmlcompany->select_departement($adh->fk_departement,$adh->pays_code); $htmlcompany->select_departement($adh->fk_departement,$adh->pays_code);
print '</td></tr>'; print '</td></tr>';
}
// Tel // Tel
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?$_POST["phone"]:$adh->phone).'"></td></tr>'; print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?$_POST["phone"]:$adh->phone).'"></td></tr>';
...@@ -1194,11 +1217,11 @@ if ($rowid && $action != 'edit') ...@@ -1194,11 +1217,11 @@ if ($rowid && $action != 'edit')
// Address // Address
print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">'; print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">';
dol_print_address($adh->adresse,'gmap','member',$adh->id); dol_print_address($adh->address,'gmap','member',$adh->id);
print '</td></tr>'; print '</td></tr>';
// Zip / Town // Zip / Town
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$adh->cp.' '.$adh->ville.'</td></tr>'; print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$adh->zip.' '.$adh->town.'</td></tr>';
// Country // Country
print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'; print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">';
......
<?php <?php
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr> /* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 201 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment