-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REF] Make use of recently added default pager size setting in Reports #20273
[REF] Make use of recently added default pager size setting in Reports #20273
Conversation
(Standard links)
|
CRM/Report/Form.php
Outdated
* | ||
* @return array | ||
*/ | ||
public function limit($rowCount = self::ROW_COUNT_LIMIT) { | ||
public function limit($rowCount = NULL) { | ||
if (CRM_Utils_System::isNull($rowCount)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see isNull isn't deprecated yet but it does unexpected things sometimes. Was this copy/paste or is there a reason to use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wanting to get the function if $rowCount was NULL rather than say 0 had been passed into the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In php 7.4 there's a nifty $rowCount ??= $this->getRowCount();
. For php 7 in general could do $rowCount = $rowcount ?? $this->getRowCount();
or there's regular is_null()
.
CRM/Report/Form.php
Outdated
/** | ||
* Class constructor. | ||
*/ | ||
public function __construct() { | ||
parent::__construct(); | ||
|
||
$this->setRowCount(\Civi::settings()->get('default_pager_size') ?? 50); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be necessary to specify ?? 50
since settings() knows to take it from the file definition so it only needs to be in one place.
Update code as per feedback from Dave D
1d3434a
to
11630f6
Compare
@demeritcowboy I believe I have updated this to what you wanted now |
Overview
This makes use of the recently added default_pager_size setting in reports
Before
Constant used, no reference to setting
After
Setting used
ping @demeritcowboy @colemanw