mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
fix for bug #323: Postal Code / City, Country / State fields confusing
This commit is contained in:
parent
a119c5301e
commit
00ea3da691
@ -996,5 +996,41 @@ class bocontacts extends socontacts
|
||||
if (isset($cache[$list])) return $cache[$list];
|
||||
|
||||
return $cache[$list] = parent::read_list($list);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the address-format of a country
|
||||
*
|
||||
* ToDo: this is far from being complete ;-)
|
||||
* Mail me (RalfBecker-AT-outdoor-training.de) if you want your nation added or add it yourself.
|
||||
*
|
||||
* @param string $country
|
||||
* @return string 'city_state_postcode' (eg. US) or 'postcode_city' (eg. DE)
|
||||
*/
|
||||
function addr_format_by_country($country)
|
||||
{
|
||||
if (!is_object($GLOBALS['egw']->country))
|
||||
{
|
||||
require_once(EGW_API_INC.'/class.country.inc.php');
|
||||
$GLOBALS['egw']->country =& new country;
|
||||
}
|
||||
$code = $GLOBALS['egw']->country->country_code($country);
|
||||
|
||||
switch($code)
|
||||
{
|
||||
case 'US':
|
||||
case 'CA':
|
||||
$adr_format = 'city_state_postcode';
|
||||
break;
|
||||
|
||||
case 'DE':
|
||||
$adr_format = 'postcode_city';
|
||||
break;
|
||||
|
||||
default:
|
||||
$adr_format = $this->prefs['addr_format'] ? $this->prefs['addr_format'] : 'postcode_city';
|
||||
}
|
||||
//echo "<p>bocontacts::addr_format_by_country('$country'='$code') = '$adr_format'</p>\n";
|
||||
return $adr_format;
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +207,18 @@ class contacts_admin_prefs
|
||||
'xmlrpc' => True,
|
||||
'admin' => false,
|
||||
);
|
||||
//show accounts in listing
|
||||
$GLOBALS['settings']['addr_format'] = array(
|
||||
'type' => 'select',
|
||||
'label' => 'Default address format',
|
||||
'name' => 'addr_format',
|
||||
'values' => array(
|
||||
'postcode_city' => lang('zip code').' '.lang('City'),
|
||||
'city_state_postcode' => lang('City').' '.lang('State').' '.lang('zip code'),
|
||||
),
|
||||
'help' => 'Which address format should the addressbook use for countries it does not know the address format. If the address format of a country is known, it uses it independent of this setting.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => false,
|
||||
);
|
||||
$GLOBALS['settings']['hide_accounts'] = array(
|
||||
'type' => 'check',
|
||||
'label' => 'Hide accounts from addressbook',
|
||||
|
@ -876,6 +876,9 @@ class uicontacts extends bocontacts
|
||||
}
|
||||
}
|
||||
}
|
||||
// hide region for address format 'postcode_city'
|
||||
if (($row['addr_format'] = $this->addr_format_by_country($row['adr_one_countryname']))=='postcode_city') unset($row['adr_one_region']);
|
||||
if (($row['addr_format2'] = $this->addr_format_by_country($row['adr_two_countryname']))=='postcode_city') unset($row['adr_two_region']);
|
||||
}
|
||||
if (!$this->prefs['no_auto_hide'])
|
||||
{
|
||||
@ -1212,6 +1215,10 @@ class uicontacts extends bocontacts
|
||||
}
|
||||
}
|
||||
}
|
||||
// how to display addresses
|
||||
$content['addr_format'] = $this->addr_format_by_country($content['adr_one_countryname']);
|
||||
$content['addr_format2'] = $this->addr_format_by_country($content['adr_two_countryname']);
|
||||
|
||||
$content['disable_change_org'] = $view || !$content['org_name'];
|
||||
//_debug_array($content);
|
||||
$readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(EGW_ACL_DELETE,$content);
|
||||
|
File diff suppressed because one or more lines are too long
@ -95,6 +95,7 @@ csv-filename addressbook de CSV-Dateiname
|
||||
custom addressbook de Benutzerdefiniert
|
||||
custom fields addressbook de Benutzerdefinierte Felder
|
||||
debug output in browser addressbook de Debugausgaben in Browser
|
||||
default address format addressbook de Vorgabe für Format der Adresse
|
||||
default addressbook for adding contacts addressbook de Vorgabe Adressbuch beim Hinzufügen von Kontakten
|
||||
default filter addressbook de Standardfilter
|
||||
delete a single entry by passing the id. addressbook de Löscht einen einzelnen Eintrag durch Übergabe seiner ID.
|
||||
@ -300,6 +301,7 @@ view linked infolog entries addressbook de Verkn
|
||||
warning!! ldap is valid only if you are not using contacts for accounts storage! admin de WARNUNG!! LDAP darf nur verwendet werden, wenn sie die Benutzerkonten nicht im Adressbuch speichern!
|
||||
warning: all contacts found will be deleted! addressbook de WARNUNG: Alle gefundenen Kontakte werden gelöscht!
|
||||
what should links to the addressbook display in other applications. empty values will be left out. you need to log in anew, if you change this setting! addressbook de Was sollen Verknüpfungen zum Adressbuch in anderen Anwendungen anzeigen. Leere Werte werden ausgelassen. Sie müssen sich neu anmelden, wenn Sie hier eine Änderung vornehmen!
|
||||
which address format should the addressbook use for countries it does not know the address format. if the address format of a country is known, it uses it independent of this setting. addressbook de Welches Format soll das Adressbuch für Adressen verwenden deren landesübliches Adressformat unbekannt ist. Wenn das Adressformat eines Landes dem Adressbuch bekannt ist, wird das unabhänig von dieser Einstellung benutzt.
|
||||
which addressbook should be selected when adding a contact and you have no add rights to the current addressbook. addressbook de Welches Adressbuch soll ausgewählt sein beim Hinzfügen von Kontakten, wenn Sie keine Hinzufügen Rechte zum aktuellen Adressbuch haben.
|
||||
which charset should be used for the csv export. the system default is the charset of this egroupware installation. addressbook de Welcher Zeichensatz soll für den CSV Export verwendet werden. Die systemweite Vorgabe ist der Zeichensatz der eGroupWare Installation.
|
||||
which fields should be exported. all means every field stored in the addressbook incl. the custom fields. the business or home address only contains name, company and the selected address. addressbook de Welche Felder sollen exportiert werden. Alle bedeutet jedes Feld das im Adressbuch gespeichert ist einschl. der benutzerdefinierten Felder. Die Geschäfts- oder Privatadresse enthält nur Name, Firma und die ausgewählte Adresse.
|
||||
|
@ -95,6 +95,7 @@ csv-filename addressbook en CSV-Filename
|
||||
custom addressbook en Custom
|
||||
custom fields addressbook en Custom Fields
|
||||
debug output in browser addressbook en Debug output in browser
|
||||
default address format addressbook en Default address format
|
||||
default addressbook for adding contacts addressbook en Default addressbook for adding contacts
|
||||
default filter addressbook en Default Filter
|
||||
delete a single entry by passing the id. addressbook en Delete a single entry by passing the id.
|
||||
@ -300,6 +301,7 @@ view linked infolog entries addressbook en View linked InfoLog entries
|
||||
warning!! ldap is valid only if you are not using contacts for accounts storage! admin en WARNING!! LDAP is valid only if you are NOT using contacts for accounts storage!
|
||||
warning: all contacts found will be deleted! addressbook en WARNING: All contacts found will be deleted!
|
||||
what should links to the addressbook display in other applications. empty values will be left out. you need to log in anew, if you change this setting! addressbook en What should links to the addressbook display in other applications. Empty values will be left out. You need to log in anew, if you change this setting!
|
||||
which address format should the addressbook use for countries it does not know the address format. if the address format of a country is known, it uses it independent of this setting. addressbook en Which address format should the addressbook use for countries it does not know the address format. If the address format of a country is known, it uses it independent of this setting.
|
||||
which addressbook should be selected when adding a contact and you have no add rights to the current addressbook. addressbook en Which addressbook should be selected when adding a contact AND you have no add rights to the current addressbook.
|
||||
which charset should be used for the csv export. the system default is the charset of this egroupware installation. addressbook en Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.
|
||||
which fields should be exported. all means every field stored in the addressbook incl. the custom fields. the business or home address only contains name, company and the selected address. addressbook en Which fields should be exported. All means every field stored in the addressbook incl. the custom fields. The business or home address only contains name, company and the selected address.
|
||||
|
@ -48,12 +48,12 @@
|
||||
</row>
|
||||
<row>
|
||||
<description/>
|
||||
<button label="Ok" onclick="set_style_by_class('table','editname','display','none'); document.getElementById(form::name('title')).focus(); return false;"/>
|
||||
<button label="Ok" onclick="set_style_by_class('table','editname','display','none'); if(document.getElementById(form::name('title'))){document.getElementById(form::name('title')).focus();} return false;"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.edit.general" template="" lang="" group="0" version="1.3.004">
|
||||
<template id="addressbook.edit.general" template="" lang="" group="0" version="1.3.005">
|
||||
<grid height="258">
|
||||
<columns>
|
||||
<column/>
|
||||
@ -115,7 +115,7 @@
|
||||
<description/>
|
||||
<textbox size="45" maxlength="64" id="adr_one_street2" statustext="address line 2"/>
|
||||
</row>
|
||||
<row>
|
||||
<row disabled="@addr_format=city_state_postcode">
|
||||
<description/>
|
||||
<description value="city" options=",,,adr_one_locality"/>
|
||||
<hbox options="0,0">
|
||||
@ -123,7 +123,7 @@
|
||||
<textbox size="35" maxlength="64" id="adr_one_locality" statustext="City" class="leftPad5"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<row disabled="@addr_format=city_state_postcode">
|
||||
<description/>
|
||||
<description value="country" options=",,,adr_one_countryname"/>
|
||||
<hbox options="0,0">
|
||||
@ -133,6 +133,22 @@
|
||||
<textbox class="leftPad5" size="19" maxlength="64" id="adr_one_region" statustext="State"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row disabled="!@addr_format=city_state_postcode">
|
||||
<description/>
|
||||
<description value="City"/>
|
||||
<hbox options="0,0">
|
||||
<textbox size="30" maxlength="64" id="adr_one_locality" statustext="City"/>
|
||||
<textbox class="leftPad5" size="3" maxlength="64" id="adr_one_region" statustext="State"/>
|
||||
<textbox size="5" maxlength="64" id="adr_one_postalcode" statustext="ZIP Code" class="leftPad5"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row disabled="!@addr_format=city_state_postcode">
|
||||
<description/>
|
||||
<description value="country" options=",,,adr_one_countryname"/>
|
||||
<menulist>
|
||||
<menupopup type="select-country" options="Select one,1" id="adr_one_countryname"/>
|
||||
</menulist>
|
||||
</row>
|
||||
<row valign="bottom" height="25">
|
||||
<image src="private.png"/>
|
||||
<description value="Addressbook"/>
|
||||
@ -159,7 +175,7 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.edit.home" template="" lang="" group="0" version="1.3.002">
|
||||
<template id="addressbook.edit.home" template="" lang="" group="0" version="1.3.003">
|
||||
<grid height="258">
|
||||
<columns>
|
||||
<column/>
|
||||
@ -177,7 +193,7 @@
|
||||
<description options=",,,adr_two_street2"/>
|
||||
<textbox size="45" maxlength="64" id="adr_two_street2" statustext="address line 2"/>
|
||||
</row>
|
||||
<row>
|
||||
<row disabled="@addr_format2=city_state_postcode">
|
||||
<description/>
|
||||
<description value="city" options=",,,adr_two_locality"/>
|
||||
<hbox options="0,0">
|
||||
@ -185,7 +201,7 @@
|
||||
<textbox size="35" maxlength="64" id="adr_two_locality" statustext="City" class="leftPad5"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<row disabled="@addr_format2=city_state_postcode">
|
||||
<description/>
|
||||
<description value="country" options=",,,adr_two_countryname"/>
|
||||
<hbox options="0,0">
|
||||
@ -195,6 +211,22 @@
|
||||
<textbox class="leftPad5" size="19" maxlength="64" id="adr_two_region" statustext="State"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row disabled="!@addr_format2=city_state_postcode">
|
||||
<description/>
|
||||
<description value="city" options=",,,adr_two_locality"/>
|
||||
<hbox options="0,0">
|
||||
<textbox size="30" maxlength="64" id="adr_two_locality" statustext="City"/>
|
||||
<textbox class="leftPad5" size="3" maxlength="64" id="adr_two_region" statustext="State"/>
|
||||
<textbox size="5" maxlength="64" id="adr_two_postalcode" statustext="ZIP Code" class="leftPad5"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row disabled="!@addr_format2=city_state_postcode">
|
||||
<description/>
|
||||
<description value="Country"/>
|
||||
<menulist>
|
||||
<menupopup type="select-country" options="Select one,1" id="adr_two_countryname"/>
|
||||
</menulist>
|
||||
</row>
|
||||
<row height="30">
|
||||
<image src="gear"/>
|
||||
<description options=",,,bday" value="Birthday"/>
|
||||
|
Loading…
Reference in New Issue
Block a user