From 4d90e6596dfd7b7e2d0a3155667632bf0f42750b Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 24 Feb 2015 05:15:35 -0500 Subject: Use also Organization field as a fallback if contact has no name(s) specified --- program/lib/Roundcube/rcube_addressbook.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'program/lib') diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php index 69027b0e8..69f8bf934 100644 --- a/program/lib/Roundcube/rcube_addressbook.php +++ b/program/lib/Roundcube/rcube_addressbook.php @@ -544,13 +544,20 @@ abstract class rcube_addressbook $fn = trim($fn, ', '); - // fallback to display name - if (empty($fn) && $contact['name']) - $fn = $contact['name']; - - // fallback to email address - if (empty($fn) && ($email = self::get_col_values('email', $contact, true)) && !empty($email)) { - return $email[0]; + // fallbacks... + if ($fn === '') { + // ... display name + if (!empty($contact['name'])) { + $fn = $contact['name']; + } + // ... organization + else if (!empty($contact['organization'])) { + $fn = $contact['organization']; + } + // ... email address + else if (($email = self::get_col_values('email', $contact, true)) && !empty($email)) { + $fn = $email[0]; + } } return $fn; -- cgit v1.2.3