summaryrefslogtreecommitdiff
path: root/program/lib/Roundcube
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-02-24 05:15:35 -0500
committerAleksander Machniak <alec@alec.pl>2015-02-24 05:15:35 -0500
commit4d90e6596dfd7b7e2d0a3155667632bf0f42750b (patch)
tree4c3a0682719d81555b0f012b3eacaee6f654d09a /program/lib/Roundcube
parent6c8cbe3ee5f0b215e8b5211127c01188d7bec030 (diff)
Use also Organization field as a fallback if contact has no name(s) specified
Diffstat (limited to 'program/lib/Roundcube')
-rw-r--r--program/lib/Roundcube/rcube_addressbook.php21
1 files changed, 14 insertions, 7 deletions
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;