Reporting #20 - correct stats when force=1 on Contribution Detail Report #17234
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://lab.civicrm.org/dev/report/issues/20
Overview
When a contribution has multiple soft credits, this causes the Contribution Detail Report to be incorrect. My previous fix, #15315, fixed the problem for the rows but not the statistics. This fixes it for both.
Steps to replicate:
force=1
: http://dmaster.localhost/civicrm/report/contribute/detail?force=1Before
Incorrect statistics.
After
Statistics are correct.
Technical Details
The heart of the issue is that most filters, when untouched, are blank/null. However, "Contributions or Soft Credits" can never be null, because there's no null value. However, that's only true when the form is loaded; when the form isn't loaded (i.e. with
force=1
), the value isNULL
. That causesforce=1
to return different results. By setting the default explicitly, this is avoided. I also revert my old fix, which treats aNULL
ascontributions_only
, since this only fixes rows and not statistics.