summaryrefslogtreecommitdiff
path: root/plugins/kolab_delegation
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-07-08 08:50:34 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-07-08 08:50:34 (GMT)
commita3122a566e9490b54f3b8bdfa4228c9bfe01c566 (patch)
tree3ca2f4c327909d34deec103362181983b20e2684 /plugins/kolab_delegation
parent18a106538b757ec299f41e6704f68e430a8e1253 (diff)
downloadroundcubemail-plugins-kolab-a3122a566e9490b54f3b8bdfa4228c9bfe01c566.tar.gz
Support contact_search_name option in kolab_delegation plugin autocompletion (#3163)
Diffstat (limited to 'plugins/kolab_delegation')
-rw-r--r--plugins/kolab_delegation/kolab_delegation_engine.php18
-rw-r--r--plugins/kolab_delegation/package.xml4
2 files changed, 17 insertions, 5 deletions
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@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>