plugins/kolab_delegation

Aleksander Machniak machniak at kolabsys.com
Tue Jul 8 10:51:33 CEST 2014


 plugins/kolab_delegation/kolab_delegation_engine.php |   18 +++++++++++++++---
 plugins/kolab_delegation/package.xml                 |    4 ++--
 2 files changed, 17 insertions(+), 5 deletions(-)

New commits:
commit a3122a566e9490b54f3b8bdfa4228c9bfe01c566
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Jul 8 10:50:34 2014 +0200

    Support contact_search_name option in kolab_delegation plugin autocompletion (#3163)

diff --git a/plugins/kolab_delegation/kolab_delegation_engine.php b/plugins/kolab_delegation/kolab_delegation_engine.php
index 3d3bd33..cb906d9 100644
--- a/plugins/kolab_delegation/kolab_delegation_engine.php
+++ b/plugins/kolab_delegation/kolab_delegation_engine.php
@@ -423,6 +423,7 @@ class kolab_delegation_engine
         $mode   = (int) $this->rc->config->get('addressbook_search_mode');
         $fields = array_unique(array_filter(array_merge((array)$this->ldap_name_field, (array)$this->ldap_login_field)));
         $users  = array();
+        $keys   = array();
 
         $result = $ldap->dosearch($fields, $search, $mode, (array)$this->ldap_login_field, $max);
 
@@ -434,12 +435,23 @@ class kolab_delegation_engine
 
             $user = $this->parse_ldap_record($record);
 
-            if ($user['name']) {
-                $users[] = $user['name'];
+            if ($user['uid']) {
+                $display = rcube_addressbook::compose_search_name($record);
+                $user    = array('name' => $user['uid'], 'display' => $display);
+                $users[] = $user;
+                $keys[]  = $display ?: $user['uid'];
             }
         }
 
-        sort($users, SORT_LOCALE_STRING);
+        if (count($users)) {
+            // sort users index
+            asort($keys, SORT_LOCALE_STRING);
+            // re-sort users according to index
+            foreach ($keys as $idx => $val) {
+                $keys[$idx] = $users[$idx];
+            }
+            $users = array_values($keys);
+        }
 
         return $users;
     }
diff --git a/plugins/kolab_delegation/package.xml b/plugins/kolab_delegation/package.xml
index 2b9d3d3..06f6ad1 100644
--- a/plugins/kolab_delegation/package.xml
+++ b/plugins/kolab_delegation/package.xml
@@ -15,9 +15,9 @@
 		<email>machniak at kolabsys.com</email>
 		<active>yes</active>
 	</lead>
-	<date>2014-06-13</date>
+	<date>2014-07-08</date>
 	<version>
-		<release>0.4</release>
+		<release>0.5</release>
 		<api>0.1</api>
 	</version>
 	<stability>




More information about the commits mailing list