From 791ee65d2e2ca2a9999986a42cfd381652c5416b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 18 Mar 2016 07:29:29 -0400
Subject: [PATCH] Fix so contactlist_fields option can be set via config file

---
 CHANGELOG                              |    1 +
 program/lib/Roundcube/rcube_config.php |    7 ++++---
 config/defaults.inc.php                |    4 ++++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 95c79ff..0b16657 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -27,6 +27,7 @@
 - Fix handling of body parameter in mail compose request
 - Protect download urls against CSRF using unique request tokens (#1490642)
 - newmail_notifier: Refactor desktop notifications
+- Fix so contactlist_fields option can be set via config file
 
 RELEASE 1.2-beta
 ----------------
diff --git a/config/defaults.inc.php b/config/defaults.inc.php
index 4339523..a482e28 100644
--- a/config/defaults.inc.php
+++ b/config/defaults.inc.php
@@ -989,6 +989,10 @@
 // Note: For LDAP sources fuzzy_search must be enabled to use 'partial' or 'prefix' mode
 $config['addressbook_search_mode'] = 0;
 
+// List of fields used on contacts list and for autocompletion searches
+// Warning: These are field names not LDAP attributes (see 'fieldmap' setting)!
+$config['contactlist_fields'] = array('name', 'firstname', 'surname', 'email');
+
 // Template of contact entry on the autocompletion list.
 // You can use contact fields as: name, email, organization, department, etc.
 // See program/steps/addressbook/func.inc for a list
diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php
index a58af37..eac5f12 100644
--- a/program/lib/Roundcube/rcube_config.php
+++ b/program/lib/Roundcube/rcube_config.php
@@ -87,9 +87,10 @@
         $this->load();
 
         // Defaults, that we do not require you to configure,
-        // but contain information that is used in various
-        // locations in the code:
-        $this->set('contactlist_fields', array('name', 'firstname', 'surname', 'email'));
+        // but contain information that is used in various locations in the code:
+        if (empty($this->prop['contactlist_fields'])) {
+            $this->set('contactlist_fields', array('name', 'firstname', 'surname', 'email'));
+        }
     }
 
     /**

--
Gitblit v1.9.1