mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Add contact label preference in order to control displayed info for To/Cc/Bcc addresses when composing an email
This commit is contained in:
parent
a467bab01f
commit
230c5ccbcd
@ -3585,6 +3585,9 @@ class mail_compose
|
||||
|
||||
$contacts_obj = new Api\Contacts();
|
||||
$results = array();
|
||||
$mailPrefs = $GLOBALS['egw_info']['user']['preferences']['mail'];
|
||||
$contactLabelPref = !is_array($mailPrefs['contactLabel']) && !empty($mailPrefs['contactLabel']) ?
|
||||
explode(',', $mailPrefs['contactLabel']) : $mailPrefs['contactLabel'];
|
||||
|
||||
// Add some matching mailing lists, and some groups, limited by config
|
||||
if($include_lists)
|
||||
@ -3655,10 +3658,10 @@ class mail_compose
|
||||
if (method_exists($contacts_obj,'search'))
|
||||
{
|
||||
$contact['n_fn']='';
|
||||
if (!empty($contact['n_prefix'])) $contact['n_fn'] = $contact['n_prefix'];
|
||||
if (!empty($contact['n_given'])) $contact['n_fn'] .= ($contact['n_fn']?' ':'').$contact['n_given'];
|
||||
if (!empty($contact['n_family'])) $contact['n_fn'] .= ($contact['n_fn']?' ':'').$contact['n_family'];
|
||||
if (!empty($contact['org_name'])) $contact['n_fn'] .= ($contact['n_fn']?' ':'').'('.$contact['org_name'].')';
|
||||
if (!empty($contact['n_prefix']) && (empty($contactLabelPref) || in_array('n_prefix', $contactLabelPref))) $contact['n_fn'] = $contact['n_prefix'];
|
||||
if (!empty($contact['n_given']) && (empty($contactLabelPref) || in_array('n_given', $contactLabelPref))) $contact['n_fn'] .= ($contact['n_fn']?' ':'').$contact['n_given'];
|
||||
if (!empty($contact['n_family']) && (empty($contactLabelPref) || in_array('n_family', $contactLabelPref))) $contact['n_fn'] .= ($contact['n_fn']?' ':'').$contact['n_family'];
|
||||
if (!empty($contact['org_name']) && (empty($contactLabelPref) || in_array('org_name', $contactLabelPref))) $contact['n_fn'] .= ($contact['n_fn']?' ':'').'('.$contact['org_name'].')';
|
||||
$contact['n_fn'] = str_replace(array(',','@'),' ',$contact['n_fn']);
|
||||
}
|
||||
else
|
||||
|
@ -451,6 +451,37 @@ class mail_hooks
|
||||
8 => lang('Ident name')
|
||||
),
|
||||
'default' => 7
|
||||
),
|
||||
'contactLabel' => array(
|
||||
'type' => 'taglist',
|
||||
'label' => 'Contact label',
|
||||
'help' => 'Defines what to show as contact label for added contact into To/Cc/Bcc when composing an email. Default is firstname lastname and empty means include eveything available.',
|
||||
'name' => 'contactLabel',
|
||||
'values' => '',
|
||||
'attributes' => array(
|
||||
'allowFreeEntries' => false,
|
||||
'editModeEnabled' => false,
|
||||
'autocomplete_url' => ' ',
|
||||
'select_options' => array (
|
||||
'n_prefix' => array (
|
||||
'id' => 'n_prefix',
|
||||
'label' => lang('Prefix'),
|
||||
),
|
||||
'n_given' => array (
|
||||
'id' => 'n_given',
|
||||
'label' => lang('First name')
|
||||
),
|
||||
'n_family' => array(
|
||||
'id' => 'n_family',
|
||||
'label' => lang('Last name')
|
||||
),
|
||||
'org_name' => array(
|
||||
'id' => 'org_name',
|
||||
'label' => lang('Organisation')
|
||||
)
|
||||
)
|
||||
),
|
||||
'default' => ['n_given','n_family']
|
||||
)
|
||||
);
|
||||
if (!$GLOBALS['egw_info']['apps']['stylite']) unset($settingsArray['attachVCardAtCompose']);
|
||||
|
Loading…
Reference in New Issue
Block a user