Skip to content
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

Reporting #20 - correct stats when force=1 on Contribution Detail Report #17234

Merged
merged 1 commit into from
May 5, 2020

Conversation

MegaphoneJon
Copy link
Contributor

@MegaphoneJon MegaphoneJon commented May 5, 2020

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:

  • Create a contribution with two soft credits.
  • Run the contribution detail report with force=1: http://dmaster.localhost/civicrm/report/contribute/detail?force=1
  • Note the (incorrect) total amount.
  • Without changing anything, press "Refresh Results".
  • Note that even though no settings have changed, the total amount is now lower (and correct).

Before

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 is NULL. That causes force=1 to return different results. By setting the default explicitly, this is avoided. I also revert my old fix, which treats a NULL as contributions_only, since this only fixes rows and not statistics.

@civibot
Copy link

civibot bot commented May 5, 2020

(Standard links)

@civibot civibot bot added the master label May 5, 2020
@seamuslee001
Copy link
Contributor

(CiviCRM Review Template WORD-1.2)

@seamuslee001 seamuslee001 merged commit 76edc0b into civicrm:master May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants