From 14a8511b3d1881a11c0ca6344822bf7d2cf06a37 Mon Sep 17 00:00:00 2001 From: Tano Rojas Date: Mon, 14 Jun 2021 23:11:05 +0700 Subject: [PATCH] FEMSSPRT-44: Fix data pagination --- CRM/PivotData/AbstractData.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/CRM/PivotData/AbstractData.php b/CRM/PivotData/AbstractData.php index d1aa302..cb0880f 100644 --- a/CRM/PivotData/AbstractData.php +++ b/CRM/PivotData/AbstractData.php @@ -76,7 +76,7 @@ abstract class CRM_PivotData_AbstractData implements CRM_PivotData_DataInterface /** * Name of data group. * - * @var string + * @var string */ protected $name = NULL; @@ -364,7 +364,6 @@ protected function getPaginatedResults(array $apiParams, $offset = 0, $multiValu $apiParams['options']['offset'] = $offset; $entities = civicrm_api3($this->apiEntityName, 'get', $apiParams); $formattedEntities = $this->formatResult($entities['values']); - $indexes = []; unset($entities); @@ -376,12 +375,9 @@ protected function getPaginatedResults(array $apiParams, $offset = 0, $multiValu break; } - $index = $split['info']['index']; - if (!in_array($index, array_keys($indexes))) { + if ($split['info']['index'] !== $index) { $page = 0; - } - else { - $page = $indexes[$index]; + $index = $split['info']['index']; } $result[] = new CRM_PivotData_DataPage($split['data'], $index, $page++, $split['info']['nextOffset'], $split['info']['multiValuesOffset']); @@ -392,7 +388,6 @@ protected function getPaginatedResults(array $apiParams, $offset = 0, $multiValu $offset = $split['info']['nextOffset']; $multiValuesOffset = $split['info']['multiValuesOffset']; - $indexes[$index] = $page; } return $result;