forked from extern/egroupware
Remove double country option from Site configuration copy fields
This commit is contained in:
parent
711ffd4fdb
commit
017d70c186
@ -66,6 +66,7 @@ class addressbook_bo extends addressbook_so
|
||||
'adr_one_region',
|
||||
'adr_one_postalcode',
|
||||
'adr_one_countryname',
|
||||
'adr_one_countrycode',
|
||||
'label',
|
||||
'tel_work',
|
||||
'tel_fax',
|
||||
@ -291,6 +292,17 @@ class addressbook_bo extends addressbook_so
|
||||
if ($GLOBALS['egw_info']['server']['org_fileds_to_update'])
|
||||
{
|
||||
$this->org_fields = unserialize($GLOBALS['egw_info']['server']['org_fileds_to_update']);
|
||||
|
||||
// Set country code if country name is selected
|
||||
$supported_fields = $this->get_fields('supported',null,0);
|
||||
if(in_array('adr_one_countrycode', $supported_fields) && in_array('adr_one_countryname',$this->org_fields))
|
||||
{
|
||||
$this->org_fields[] = 'adr_one_countrycode';
|
||||
}
|
||||
if(in_array('adr_two_countrycode', $supported_fields) && in_array('adr_two_countryname',$this->org_fields))
|
||||
{
|
||||
$this->org_fields[] = 'adr_two_countrycode';
|
||||
}
|
||||
}
|
||||
$this->categories = new categories($this->user,'addressbook');
|
||||
|
||||
|
@ -95,6 +95,17 @@ class addressbook_ui extends addressbook_bo
|
||||
}
|
||||
if ($this->config['copy_fields'] && ($fields = unserialize($this->config['copy_fields'])))
|
||||
{
|
||||
// Set country code if country name is selected
|
||||
$supported_fields = $this->get_fields('supported',null,0);
|
||||
if(in_array('adr_one_countrycode', $supported_fields) && in_array('adr_one_countryname',$fields))
|
||||
{
|
||||
$fields[] = 'adr_one_countrycode';
|
||||
}
|
||||
if(in_array('adr_two_countrycode', $supported_fields) && in_array('adr_two_countryname',$fields))
|
||||
{
|
||||
$fields[] = 'adr_two_countrycode';
|
||||
}
|
||||
|
||||
self::$copy_fields = $fields;
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +107,13 @@ function org_fileds_to_update($config)
|
||||
$fields['#'.$name] = $data['label'];
|
||||
}
|
||||
}
|
||||
|
||||
// Remove country codes as an option, it will be added by BO constructor
|
||||
if(in_array('adr_one_countrycode', $supported_fields))
|
||||
{
|
||||
unset($fields['adr_one_countrycode']);
|
||||
unset($fields['adr_two_countrycode']);
|
||||
}
|
||||
return html::checkbox_multiselect('newsettings[org_fileds_to_update]',
|
||||
$config['org_fileds_to_update'] ? $config['org_fileds_to_update'] : $bocontacts->org_fields,$fields,true,'',4);
|
||||
}
|
||||
@ -138,6 +145,12 @@ function copy_fields($config)
|
||||
$fields['#'.$name] = $data['label'];
|
||||
}
|
||||
}
|
||||
// Remove country codes as an option, it will be added by UI constructor
|
||||
if(in_array('adr_one_countrycode', $supported_fields))
|
||||
{
|
||||
unset($fields['adr_one_countrycode']);
|
||||
unset($fields['adr_two_countrycode']);
|
||||
}
|
||||
|
||||
return html::checkbox_multiselect('newsettings[copy_fields]',
|
||||
$config['copy_fields'] ? $config['copy_fields'] : addressbook_ui::$copy_fields,
|
||||
|
Loading…
Reference in New Issue
Block a user