plugins/kolab_addressbook

Aleksander Machniak machniak at kolabsys.com
Mon Sep 9 12:40:24 CEST 2013


 plugins/kolab_addressbook/lib/rcube_kolab_contacts.php |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit c8174100f6102fb98c46cdd5ce63f743522a92dc
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Mon Sep 9 12:40:00 2013 +0200

    Small improvements in contacts list/search handling

diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
index b0096c4..4baef45 100644
--- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
+++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
@@ -286,19 +286,20 @@ class rcube_kolab_contacts extends rcube_addressbook
             }
 
             $ids = array_keys($this->contacts);
-            $this->result->count = count($this->contacts);
         }
         else if (is_array($this->filter['ids'])) {
             $ids = $this->filter['ids'];
-            if ($this->result->count = count($ids)) {
+            if (count($ids)) {
                 $uids = array_map(array($this, 'id2uid'), $this->filter['ids']);
                 $this->_fetch_contacts(array(array('uid', '=', $uids)));
             }
+            else {
+                $this->contacts = array();
+            }
         }
         else {
             $this->_fetch_contacts();
             $ids = array_keys($this->contacts);
-            $this->result->count = count($ids);
         }
 
         // sort data arrays according to desired list sorting
@@ -309,6 +310,8 @@ class rcube_kolab_contacts extends rcube_addressbook
                 $ids = array_values(array_intersect(array_keys($this->contacts), $ids));
             else
                 $ids = array_keys($this->contacts);
+
+            $this->result->count = count($ids);
         }
 
         // fill contact data into the current result set
@@ -420,6 +423,11 @@ class rcube_kolab_contacts extends rcube_addressbook
                 $this->filter['ids'][] = $id;
         }
 
+        // dummy result with contacts count
+        if (!$select) {
+            return new rcube_result_set(count($this->filter['ids']), ($this->list_page-1) * $this->page_size);
+        }
+
         // list records (now limited by $this->filter)
         return $this->list_records();
     }




More information about the commits mailing list