Fix: Restore autozip features

This commit is contained in:
Laurent Destailleur 2011-12-28 21:30:33 +01:00
parent 8d5972c8f4
commit e8f84363eb
4 changed files with 21 additions and 13 deletions

View File

@ -116,8 +116,10 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
$row_array['value'] = $row['town'];
$row_array['zipcode'] = $row['zip'];
}
$row_array['selectpays_id'] = $row['fk_country'];
$row_array['departement_id'] = $row['fk_county'];
$row_array['selectpays_id'] = $row['fk_country']; // TODO deprecated
$row_array['departement_id'] = $row['fk_county']; // TODO deprecated
$row_array['selectcountry_id'] = $row['fk_country'];
$row_array['state_id'] = $row['fk_county'];
$row_array['states'] = $formcompany->select_state('',$row['fk_country'],'');

View File

@ -83,6 +83,7 @@ function ajax_autocompleter($selected='',$htmlname,$url,$option='',$minLength=2,
/**
* Get value of field, do Ajax process and return result
*
* @param htmlname nom et id du champ
* @param fields other fields to autocomplete
* @param url chemin du fichier de reponse : /chemin/fichier.php
@ -128,7 +129,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
for (i=0;i<length;i++) {
//alert(fields[i] + " = " + ui.item[fields[i]]);
if (fields[i]=="selectpays_id")
if (fields[i]=="selectcountry_id" || fields[i]=="selectpays_id")
{
if (ui.item[fields[i]] > 0) // Do not erase country if unknown
{
@ -139,7 +140,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
}
}
}
else if (fields[i]=="departement_id")
else if (fields[i]=="state_id" || fields[i]=="departement_id")
{
if (ui.item[fields[i]] > 0) // Do not erase state if unknown
{

View File

@ -776,7 +776,7 @@ else
// Country
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
$form->select_pays($object->country_id,'country_id');
print $form->select_country($object->country_id,'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>';
@ -1028,7 +1028,7 @@ else
$object->address = $_POST["adresse"];
$object->zip = $_POST["zipcode"];
$object->town = $_POST["town"];
$object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->pays_id;
$object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
$object->state_id = $_POST["departement_id"];
$object->tel = $_POST["tel"];
$object->fax = $_POST["fax"];
@ -1221,7 +1221,7 @@ else
// Country
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
$form->select_pays($object->country_id,'country_id');
print $form->select_country($object->country_id,'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>';

View File

@ -187,13 +187,18 @@ if ($result >= 0)
$member->pass=$ldapuser[$conf->global->LDAP_FIELD_PASSWORD];
//$member->societe;
$member->address=$ldapuser[$conf->global->LDAP_FIELD_ADDRESS];
$member->adresse=$ldapuser[$conf->global->LDAP_FIELD_ADDRESS]; // TODO obsolete
$member->cp=$ldapuser[$conf->global->LDAP_FIELD_ZIP];
$member->ville=$ldapuser[$conf->global->LDAP_FIELD_TOWN];
$member->pays=$ldapuser[$conf->global->LDAP_FIELD_COUNTRY]; // Pays en libelle
$member->pays_id=$countries[$hashlib2rowid[strtolower($member->pays)]]['rowid'];
$member->pays_code=$countries[$hashlib2rowid[strtolower($member->pays)]]['code'];
$member->address=$ldapuser[$conf->global->LDAP_FIELD_ADDRESS];
$member->cp=$ldapuser[$conf->global->LDAP_FIELD_ZIP]; // TODO obsolete
$member->zip=$ldapuser[$conf->global->LDAP_FIELD_ZIP];
$member->ville=$ldapuser[$conf->global->LDAP_FIELD_TOWN]; // TODO obsolete
$member->town=$ldapuser[$conf->global->LDAP_FIELD_TOWN];
$member->pays=$ldapuser[$conf->global->LDAP_FIELD_COUNTRY]; // TODO obsolete
$member->country=$ldapuser[$conf->global->LDAP_FIELD_COUNTRY];
$member->pays_id=$countries[$hashlib2rowid[strtolower($member->country)]]['rowid']; // TODO obsolete
$member->country_id=$countries[$hashlib2rowid[strtolower($member->country)]]['rowid'];
$member->pays_code=$countries[$hashlib2rowid[strtolower($member->country)]]['code']; // TODO obsolete
$member->country_code=$countries[$hashlib2rowid[strtolower($member->country)]]['code'];
$member->phone=$ldapuser[$conf->global->LDAP_FIELD_PHONE];
$member->phone_perso=$ldapuser[$conf->global->LDAP_FIELD_PHONE_PERSO];