plugins/libkolab

Thomas Brüderli bruederli at kolabsys.com
Fri May 31 18:17:06 CEST 2013


 plugins/libkolab/lib/kolab_format_contact.php |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 054807c784723b403989facd29ce3117ac2ed601
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Fri May 31 18:16:54 2013 +0200

    Fix contact fulltext indexing with new email subtypes

diff --git a/plugins/libkolab/lib/kolab_format_contact.php b/plugins/libkolab/lib/kolab_format_contact.php
index 99b25bc..d8b5162 100644
--- a/plugins/libkolab/lib/kolab_format_contact.php
+++ b/plugins/libkolab/lib/kolab_format_contact.php
@@ -31,7 +31,7 @@ class kolab_format_contact extends kolab_format
     protected $read_func = 'readContact';
     protected $write_func = 'writeContact';
 
-    public static $fulltext_cols = array('name', 'firstname', 'surname', 'middlename', 'email');
+    public static $fulltext_cols = array('name', 'firstname', 'surname', 'middlename', 'email:address');
 
     public $phonetypes = array(
         'home'    => Telephone::Home,
@@ -385,7 +385,18 @@ class kolab_format_contact extends kolab_format
     {
         $data = '';
         foreach (self::$fulltext_cols as $col) {
-            $val = is_array($this->data[$col]) ? join(' ', $this->data[$col]) : $this->data[$col];
+            list($col, $field) = explode(':', $colname);
+
+            if ($field) {
+                $a = array();
+                foreach ((array)$this->data[$col] as $attr)
+                    $a[] = $attr[$field];
+                $val = join(' ', $a);
+            }
+            else {
+                $val = is_array($this->data[$col]) ? join(' ', $this->data[$col]) : $this->data[$col];
+            }
+
             if (strlen($val))
                 $data .= $val . ' ';
         }





More information about the commits mailing list