plugins/kolab_addressbook

Aleksander Machniak machniak at kolabsys.com
Fri Dec 5 13:03:44 CET 2014


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

New commits:
commit 47700a1b3cce26735bece2ddcb5f6e8e8015603f
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Fri Dec 5 07:03:20 2014 -0500

    Fix duplicate contacts on the list after contact delete (#4028)
    
    Conflicts:
    
    	plugins/kolab_addressbook/lib/rcube_kolab_contacts.php

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




More information about the commits mailing list