From f41edfb91f377d2bcede8d28662fb1aedf87ce37 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 13 Mar 2013 07:02:04 -0400
Subject: [PATCH] Fix draglayer list building, so the element used as the text source can contain any element, not only A tag or text node, but also e.g. span

---
 program/lib/Roundcube/rcube_addressbook.php |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php
index ffe3509..cbc3c67 100644
--- a/program/lib/Roundcube/rcube_addressbook.php
+++ b/program/lib/Roundcube/rcube_addressbook.php
@@ -45,8 +45,8 @@
     public $sort_col = 'name';
     public $sort_order = 'ASC';
     public $coltypes = array('name' => array('limit'=>1), 'firstname' => array('limit'=>1), 'surname' => array('limit'=>1), 'email' => array('limit'=>1));
+    public $date_cols = array();
 
-    protected $date_types = array();
     protected $error;
 
     /**
@@ -524,6 +524,22 @@
     }
 
     /**
+     * Create a unique key for sorting contacts
+     */
+    public static function compose_contact_key($contact, $sort_col)
+    {
+        $key = $contact[$sort_col] . ':' . $row['sourceid'];
+
+        // add email to a key to not skip contacts with the same name (#1488375)
+        if (!empty($contact['email'])) {
+             $key .= ':' . implode(':', (array)$contact['email']);
+         }
+
+         return $key;
+    }
+
+
+    /**
      * Compare search value with contact data
      *
      * @param string       $colname Data name
@@ -538,7 +554,7 @@
         // The value is a date string, for date we'll
         // use only strict comparison (mode = 1)
         // @TODO: partial search, e.g. match only day and month
-        if (in_array($colname, $this->date_types)) {
+        if (in_array($colname, $this->date_cols)) {
             return (($value = rcube_utils::strtotime($value))
                 && ($search = rcube_utils::strtotime($search))
                 && date('Ymd', $value) == date('Ymd', $search));

--
Gitblit v1.9.1