mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-27 00:09:13 +01:00
Use the two letter ISO country code, or allow user to use a free text country field (custom) to preserve syncing
This commit is contained in:
parent
6029b5043f
commit
5524c3573c
@ -553,6 +553,14 @@ class addressbook_sql extends so_sql_cf
|
||||
}
|
||||
$contact = parent::read($keys,$extra_cols,$join);
|
||||
|
||||
// Translate country code
|
||||
if($contact['adr_one_countrycode'] != null) {
|
||||
$contact['adr_one_countryname'] = $GLOBALS['egw']->country->get_full_name($contact['adr_one_countrycode'], true);
|
||||
}
|
||||
if($contact['adr_two_countrycode'] != null) {
|
||||
$contact['adr_two_countryname'] = $GLOBALS['egw']->country->get_full_name($contact['adr_two_countrycode'], true);
|
||||
}
|
||||
|
||||
// Change autoinc_id to match $this->db_cols
|
||||
$this->autoinc_id = $this->db_cols[$this->autoinc_id];
|
||||
if(($id = (int)$this->data[$this->autoinc_id]) && $cfs = $this->read_customfields($keys)) {
|
||||
|
@ -1271,6 +1271,14 @@ class addressbook_ui extends addressbook_bo
|
||||
{
|
||||
unset($content['n_fn']);
|
||||
}
|
||||
// Country codes
|
||||
foreach(array('adr_one', 'adr_two') as $c_prefix)
|
||||
{
|
||||
if ($content[$c_prefix.'_countrycode'] == '-custom-')
|
||||
{
|
||||
$content[$c_prefix.'_countrycode'] = null;
|
||||
}
|
||||
}
|
||||
if ($this->save($content))
|
||||
{
|
||||
$content['msg'] = lang('Contact saved');
|
||||
@ -1458,6 +1466,8 @@ class addressbook_ui extends addressbook_bo
|
||||
// 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']);
|
||||
$GLOBALS['egw']->js->set_onload('show_custom_country(document.getElementById("exec[adr_one_countrycode]"));');
|
||||
$GLOBALS['egw']->js->set_onload('show_custom_country(document.getElementById("exec[adr_two_countrycode]"));');
|
||||
|
||||
$content['disable_change_org'] = $view || !$content['org_name'];
|
||||
//_debug_array($content);
|
||||
@ -2049,6 +2059,28 @@ class addressbook_ui extends addressbook_bo
|
||||
}
|
||||
selbox.value = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function show_custom_country(selectbox)
|
||||
{
|
||||
custom_field_name = selectbox.name.replace("countrycode", "countryname");
|
||||
custom_field = document.getElementById(custom_field_name);
|
||||
if(custom_field && selectbox.value == "-custom-") {
|
||||
custom_field.style.display = "inline";
|
||||
}
|
||||
else if (custom_field)
|
||||
{
|
||||
if(selectbox.value == "" || selectbox.value == null)
|
||||
{
|
||||
selectbox.value = "-custom-";
|
||||
custom_field.style.display = "inline";
|
||||
}
|
||||
else
|
||||
{
|
||||
custom_field.style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,6 @@
|
||||
.cursorHand { cursor: hand; }
|
||||
.countrySelect select { width: 150px; }
|
||||
.custom_country input {display: none; }
|
||||
.emailCol div { width: 100%; overflow: hidden; }
|
||||
.redItalic { color: red; font-style: italic; }
|
||||
.fixedHeight,.telNumbers { height: 12px; }
|
||||
|
Loading…
Reference in New Issue
Block a user