diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 41ef660bc..d409ff42e 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -968,11 +968,11 @@ $config['addressbook_pagesize'] = 50; // sort contacts by this col (preferably either one of name, firstname, surname) $config['addressbook_sort_col'] = 'surname'; -// the way how contact names are displayed in the list -// 0: display name -// 1: (prefix) firstname middlename surname (suffix) -// 2: (prefix) surname firstname middlename (suffix) -// 3: (prefix) surname, firstname middlename (suffix) +// The way how contact names are displayed in the list. +// 0: prefix firstname middlename surname suffix (only if display name is not set) +// 1: firstname middlename surname +// 2: surname firstname middlename +// 3: surname, firstname middlename $config['addressbook_name_listing'] = 0; // use this timezone to display date/time diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php index edb63fe14..809f23a21 100644 --- a/program/lib/Roundcube/rcube_addressbook.php +++ b/program/lib/Roundcube/rcube_addressbook.php @@ -494,8 +494,11 @@ abstract class rcube_addressbook $contact = rcube::get_instance()->plugins->exec_hook('contact_displayname', $contact); $fn = $contact['name']; - if (!$fn) // default display name composition according to vcard standard - $fn = trim(join(' ', array_filter(array($contact['prefix'], $contact['firstname'], $contact['middlename'], $contact['surname'], $contact['suffix'])))); + // default display name composition according to vcard standard + if (!$fn) { + $fn = join(' ', array_filter(array($contact['prefix'], $contact['firstname'], $contact['middlename'], $contact['surname'], $contact['suffix']))); + $fn = trim(preg_replace('/\s+/', ' ', $fn)); + } // use email address part for name $email = self::get_col_values('email', $contact, true); @@ -544,6 +547,7 @@ abstract class rcube_addressbook } $fn = trim($fn, ', '); + $fn = preg_replace('/\s+/', ' ', $fn); // fallbacks... if ($fn === '') {