Fix duplicate contacts on the list after contact delete (#4028)

Conflicts:

	plugins/kolab_addressbook/lib/rcube_kolab_contacts.php
This commit is contained in:
Aleksander Machniak 2014-12-05 07:03:20 -05:00
parent b8a631c06d
commit 47700a1b3c

View file

@ -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]));
}
}