summaryrefslogtreecommitdiff
path: root/plugins/kolab_addressbook
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-12-05 12:03:20 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-12-05 12:03:20 (GMT)
commit47700a1b3cce26735bece2ddcb5f6e8e8015603f (patch)
treed11d8753a084476f72d54590d7929b6ae4a92373 /plugins/kolab_addressbook
parentb8a631c06d0c36d733b3bf0839bab936d6623f1b (diff)
downloadroundcubemail-plugins-kolab-47700a1b3cce26735bece2ddcb5f6e8e8015603f.tar.gz
Fix duplicate contacts on the list after contact delete (#4028)
Conflicts: plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
Diffstat (limited to 'plugins/kolab_addressbook')
-rw-r--r--plugins/kolab_addressbook/lib/rcube_kolab_contacts.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
index fa21583..1443e86 100644
--- a/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
+++ b/plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
@@ -364,7 +364,7 @@ class rcube_kolab_contacts extends rcube_addressbook
}
}
}
- else if (isset($this->dataset)) {
+ else if (!empty($this->dataset)) {
// get all records count, skip the query if possible
if (!isset($query) || count($this->dataset) < $this->page_size) {
$this->result->count = count($this->dataset) + $this->page_size * ($this->list_page - 1);
@@ -373,8 +373,11 @@ class rcube_kolab_contacts extends rcube_addressbook
$this->result->count = $this->storagefolder->count($query);
}
- foreach ($this->dataset as $idx => $record) {
- $this->result->add($this->_to_rcube_contact($record));
+ $start_row = $subset < 0 ? $this->page_size + $subset : 0;
+ $last_row = min($subset != 0 ? $start_row + abs($subset) : $this->page_size, $this->result->count);
+
+ for ($i = $start_row; $i < $last_row; $i++) {
+ $this->result->add($this->_to_rcube_contact($this->dataset[$i]));
}
}