SuiteCRM icon indicating copy to clipboard operation
SuiteCRM copied to clipboard

Pagination / 'meta' field is inconsistent

Open qozle opened this issue 2 years ago • 0 comments

Issue

When sending a request with a single filter field "filter[status_c][eq]" => "Active", and page[size]=500 (whether page[number] is included or not), the meta field in the response is:

"meta": {
    "total-pages": 0,
    "records-on-this-page": 500
 }

where the total pages should definitely be around 5 (doing the same request as above, but without the filter parameter (with or without page[number]), yields 5 total pages).

But when sending a similar request with the following params, I get the expected meta (total pages is not 0):

$params = [
	'fields[SR_ShopReports]'=> 'date_entered,created_by,created_by_name,number_of_marketing_envelope_c,number_of_marketing_calls_c,lobby_photo_c,storefront_photo_c,work_area_photo_c,womm_photo_c,miscellaneous_photo_1_c,miscellaneous_photo_2_c,visit_type,total_time',
	'page[size]'=> $page_size,
	'page[number]' => 1,
	'filter[date_entered][gte]'=> "{$year_range_start}T00:00:00-04:00",
	'filter[operator]'=>'and',
	'filter[date_entered][lte]'=> "{$year_range_end}T23:59:59-04:00"
];

Expected Behavior

total-pages should be ~5.

Actual Behavior

total-pages is 0.

Possible Fix

Current work around is to leave out the filter, and filter the response manually.

Steps to Reproduce

  1. Perform a request that should yield multiple pages, using the page[size] and filter option parameters

Context

This bug has affected my personal well being as it causes me to cry with frustration every time I see the total-pages field is incorrect, and breaks my heart that I have to manually filter the results. However, it has inspired me to write this bug report and I am recovering, with the hope of a resolution and the feeling of contributing causing me to feel warm inside.

Your Environment

Ubuntu 20.04.5 LTS, PHP 7.4, suiteCRM 7.12.5

  • SuiteCRM Version used:
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)):
  • Environment name and version (e.g. MySQL, PHP 7):
  • Operating System and version (e.g Ubuntu 16.04):

qozle avatar Sep 08 '22 15:09 qozle