From 4d90e6596dfd7b7e2d0a3155667632bf0f42750b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 24 Feb 2015 05:15:35 -0500
Subject: [PATCH] Use also Organization field as a fallback if contact has no name(s) specified
---
program/lib/Roundcube/rcube_addressbook.php | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php
index 69027b0..69f8bf9 100644
--- a/program/lib/Roundcube/rcube_addressbook.php
+++ b/program/lib/Roundcube/rcube_addressbook.php
@@ -544,13 +544,20 @@
$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;
--
Gitblit v1.9.1