diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php index b0096c49..4baef45f 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(); }