summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas B <roundcube@gmail.com>2012-02-13 22:20:59 (GMT)
committerThomas B <roundcube@gmail.com>2012-02-13 22:20:59 (GMT)
commitb765d9092545027f06195c1feb02a8c41a53dc3a (patch)
tree99b4ab090e8bd55a8923debc184b1a0fcb58edef
parent453f5f953ac2aaf2d98483d7c41df309f98c27f8 (diff)
parent145258abf79c09178742ce4a10f1dac44cf5f3b9 (diff)
downloadroundcubemail-plugins-kolab-b765d9092545027f06195c1feb02a8c41a53dc3a.tar.gz
Merge branch 'master' of ssh://git.kolabsys.com/git/roundcube
-rw-r--r--plugins/kolab_addressbook/lib/rcube_kolab_contacts.php36
1 files changed, 22 insertions, 14 deletions
diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
index 531eec7..f028f52 100644
--- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
+++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
@@ -1017,22 +1017,30 @@ class rcube_kolab_contacts extends rcube_addressbook
*/
private function _sort_contacts_comp($a, $b)
{
- $a_value = $a[$this->sort_col];
- $b_value = $b[$this->sort_col];
-
- if (!$a_value && $this->sort_col == 'name') {
- $a_value = join(' ', array_filter(array($a['firstname'], $a['middlename'], $a['surname'])));
- }
- if (!$a_value) {
- $a_value = is_array($a['email']) ? $a['email'][0] : $a['email'];
+ $a_value = $b_value = '';
+
+ switch ($this->sort_col) {
+ case 'name':
+ $a_value = $a['name'] . $a['prefix'];
+ $b_value = $b['name'] . $b['prefix'];
+ case 'firstname':
+ $a_value .= $a['firstname'] . $a['middlename'] . $a['surname'];
+ $b_value .= $b['firstname'] . $b['middlename'] . $b['surname'];
+ break;
+
+ case 'surname':
+ $a_value = $a['surname'] . $a['firstname'] . $a['middlename'];
+ $b_value = $b['surname'] . $b['firstname'] . $b['middlename'];
+ break;
+
+ default:
+ $a_value = $a[$this->sort_col];
+ $b_value = $b[$this->sort_col];
+ break;
}
- if (!$b_value && $this->sort_col == 'name') {
- $b_value = join(' ', array_filter(array($b['firstname'], $b['middlename'], $b['surname'])));
- }
- if (!$b_value) {
- $b_value = is_array($b['email']) ? $b['email'][0] : $b['email'];
- }
+ $a_value .= is_array($a['email']) ? $a['email'][0] : $a['email'];
+ $b_value .= is_array($b['email']) ? $b['email'][0] : $b['email'];
// return strcasecmp($a_value, $b_value);
// make sorting unicode-safe and locale-dependent