mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 00:58:56 +01:00
* Addressbook: allow keeping custom fileAs value (LDAP: displayname) by adding it as first option
This commit is contained in:
parent
82b41c2d62
commit
4c503d61ea
@ -2922,6 +2922,9 @@ class addressbook_ui extends addressbook_bo
|
||||
|
||||
$ret = array('doublicates' => array(), 'msg' => null);
|
||||
|
||||
// set not returned n_fileas value, to keep custom fileas value
|
||||
$values['n_fileas'] = $this->fileas($values, $values['fileas_type']);
|
||||
|
||||
// if email changed, check for doublicates
|
||||
if (in_array($name, array('email', 'email_home')) && in_array('contact_'.$name, $fields))
|
||||
{
|
||||
@ -3595,4 +3598,4 @@ class addressbook_ui extends addressbook_bo
|
||||
// those options instead of the select-account options.
|
||||
$sel_options['history']['owner'] = ['ignore' => 'me'];
|
||||
}
|
||||
}
|
||||
}
|
@ -509,13 +509,14 @@ class Contacts extends Contacts\Storage
|
||||
{
|
||||
foreach($this->fileas_types as $type)
|
||||
{
|
||||
if ($this->fileas($contact,$type) == $file_as)
|
||||
if ($this->fileas($contact,$type) === $file_as)
|
||||
{
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->prefs['fileas_default'] ? $this->prefs['fileas_default'] : $this->fileas_types[0];
|
||||
// if none of our types matches, but a non-empty value is set, keep it
|
||||
return $file_as ?: $this->prefs['fileas_default'] ?: $this->fileas_types[0];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -558,9 +559,16 @@ class Contacts extends Contacts\Storage
|
||||
{
|
||||
if ($contact[$name]) $labels[$name] = $contact[$name];
|
||||
}
|
||||
$found = false;
|
||||
foreach($this->fileas_types as $fileas_type)
|
||||
{
|
||||
$options[$fileas_type] = $this->fileas($labels,$fileas_type);
|
||||
$options[$fileas_type] = $value = $this->fileas($labels,$fileas_type);
|
||||
$found = $found || $value === $contact['n_fileas'];
|
||||
}
|
||||
// if we have a custom fileAs, add it as first option to keep it
|
||||
if (!empty($contact['n_fileas']) && !$found)
|
||||
{
|
||||
$options = array_merge([$contact['n_fileas'] => lang('Custom').': '.$contact['n_fileas']], $options);
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
@ -2957,4 +2965,4 @@ class Contacts extends Contacts\Storage
|
||||
error_log("crm.php: calling push(#$this->user)->call('$func', $arg)");
|
||||
return "calling push(#$this->user)->call('$func', $arg)";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user