mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-22 13:20:50 +01:00
Add missing part of country code changes (r38733)
This commit is contained in:
parent
b4c68cd2df
commit
da90d4901a
@ -1281,6 +1281,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');
|
||||
@ -1381,6 +1389,8 @@ class addressbook_ui extends addressbook_bo
|
||||
{
|
||||
if ($GLOBALS['egw_info']['user']['preferences']['common']['country'])
|
||||
{
|
||||
$content['adr_one_countrycode'] =
|
||||
$GLOBALS['egw_info']['user']['preferences']['common']['country'];
|
||||
$content['adr_one_countryname'] =
|
||||
$GLOBALS['egw']->country->get_full_name($GLOBALS['egw_info']['user']['preferences']['common']['country']);
|
||||
}
|
||||
@ -1462,6 +1472,9 @@ 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);
|
||||
@ -1684,6 +1697,11 @@ class addressbook_ui extends addressbook_bo
|
||||
{
|
||||
$content['owner'] .= 'p';
|
||||
}
|
||||
|
||||
// Prevent double countries - invalid code blanks it, disabling doesn't work
|
||||
$content['adr_one_countrycode'] = '-';
|
||||
$content['adr_two_countrycode'] = '-';
|
||||
|
||||
// disable not needed tabs
|
||||
$readonlys['tabs']['cats'] = !($content['cat_tab'] = $this->config['cat_tab']);
|
||||
$readonlys['tabs']['custom'] = !$this->customfields;
|
||||
@ -2005,6 +2023,26 @@ 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
@ -118,7 +118,9 @@
|
||||
<image src="${row}[photo]" class="iphoto"/>
|
||||
<date id="${row}[bday]" readonly="true" options="Y-m-d"/>
|
||||
<vbox options="0,0">
|
||||
<description id="${row}[adr_one_countryname]" no_lang="1"/>
|
||||
<menulist>
|
||||
<menupopup type="select-country" id="${row}[adr_one_countrycode]" no_lang="1" readonly="true"/>
|
||||
</menulist>
|
||||
<hbox options="0,0" orient="0">
|
||||
<description no_lang="1" id="${row}[adr_one_locality]"/>
|
||||
<description class="leftPad5" no_lang="1" id="${row}[adr_one_region]"/>
|
||||
@ -128,7 +130,9 @@
|
||||
<description id="${row}[adr_one_street2]" no_lang="1"/>
|
||||
</vbox>
|
||||
<vbox options="0,0">
|
||||
<description id="${row}[adr_two_countryname]" no_lang="1"/>
|
||||
<menulist>
|
||||
<menupopup type="select-country" id="${row}[adr_two_countrycode]" no_lang="1" readonly="true"/>
|
||||
</menulist>
|
||||
<hbox options="0,0">
|
||||
<description no_lang="1" id="${row}[adr_two_locality]"/>
|
||||
<description no_lang="1" id="${row}[adr_two_region]" class="leftPad5"/>
|
||||
|
@ -139,15 +139,25 @@ class select_widget
|
||||
);
|
||||
break;
|
||||
|
||||
case 'select-country': // #Row|Extralabel,1=use country name, 0=use 2 letter-code
|
||||
$cell['sel_options'] = $GLOBALS['egw']->country->countries();
|
||||
|
||||
case 'select-country': // #Row|Extralabel,1=use country name, 0=use 2 letter-code,custom country field name
|
||||
if($type == 0 && $type2)
|
||||
{
|
||||
$custom_label = is_numeric($type2) ? 'Custom' : $type2;
|
||||
$cell['sel_options'] = array('-custom-' => lang($custom_label)) + $GLOBALS['egw']->country->countries();
|
||||
}
|
||||
else
|
||||
{
|
||||
$cell['sel_options'] = $GLOBALS['egw']->country->countries();
|
||||
}
|
||||
if (($extension_data['country_use_name'] = $type) && $value)
|
||||
{
|
||||
$value = $GLOBALS['egw']->country->country_code($value);
|
||||
if (!isset($cell['sel_options'][$value]))
|
||||
{
|
||||
$cell['sel_options'][$value] = $value;
|
||||
if($type2)
|
||||
{
|
||||
$cell['sel_options'][$value] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
$cell['no_lang'] = True;
|
||||
|
Loading…
Reference in New Issue
Block a user