CRM-16056 - Core CiviCRM - Fix populating prev/next cache when jumping > 500 records...
authorJon goldberg <jon@palantetech.coop>
Thu, 12 Mar 2015 03:42:28 +0000 (23:42 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 12 Mar 2015 14:18:10 +0000 (10:18 -0400)
CRM/Contact/Selector.php

index 94cd3c49aed67595611b495eb951e399ef06b98e..37c7d3e92f83008edda579d60823e13ff9481ccf 100644 (file)
@@ -884,14 +884,13 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
 
     //for text field pagination selection save
     $countRow = CRM_Core_BAO_PrevNextCache::getCount($cacheKey, NULL, "entity_table = 'civicrm_contact'");
-
     // $sortByCharacter triggers a refresh in the prevNext cache
     if ($sortByCharacter && $sortByCharacter != 'all') {
       $cacheKey .= "_alphabet";
       $this->fillupPrevNextCache($sort, $cacheKey);
     }
     elseif ($firstRecord >= $countRow) {
-      $this->fillupPrevNextCache($sort, $cacheKey, $countRow, 500);
+      $this->fillupPrevNextCache($sort, $cacheKey, $countRow, 500 + $firstRecord - $countRow);
     }
     return $cacheKey;
   }