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

dev/financial#139 contribution receive_date shouldn't change when payments come in #17777

Merged
merged 6 commits into from
Jul 30, 2020

Conversation

agh1
Copy link
Contributor

@agh1 agh1 commented Jul 9, 2020

Overview

The contribution receive_date would change when payments arrive on a pending contribution. This can cause reporting mayhem (your June totals may go down if you run the report after some payments arrive in July), and it generally goes against fundraisers' accrual perspective of donations.

This is a regression appearing in 5.18, but addressing it ran into issues dating to users' expectations from the "Update pending contribution status" search action (expressed in CRM-17146). Because it was using the IPN code, users assumed that the date specified on the payment should actually update the contribution's date because that code treated the two identically.

The solution was to rework that form so it strictly records a bunch of payments. The dates will become trxn_date on the payment, and the contribution receive_date is left intact. The contribution statuses will get updated according to the normal rules (which should always result in "Completed" because at least as of now the form will only let you record payments in full). If you want to edit contribution statuses, you can always batch update with a profile.

That meant I could remove the contribution status field, and in the process I renamed the action "Record payments for contributions" to better reflect this. The main use case is when someone checks the mail and has a stack of checks.

See dev/financial#139 for extensive discussion.

Before

  1. Recording a payment that completes a contribution updates the contribution receive_date to the payment's trxn_date.

  2. There's a search action called "Update pending contribution status".

    image

  3. Someone using "Update pending contribution status" is invited to manually set the contribution status, which could lead to unexpected results.

    image

After

  1. The contribution receive_date does not change unless you manually change it, even if it becomes completed.

  2. The search action is renamed "Record payments for contributions".

    image

  3. There is no field to set the contribution status on that search action. The help text suggests using batch edit with profiles.

    image

Technical Details

I added and updated a bunch of tests, including several instances where they are testing the opposite result of what they used to test.

Comments

It might be a nice improvement to that multiple payment form to allow for payments with different amounts, and it should work fine setting the contribution status to Partially Paid as appropriate. Similarly, it might be nice to allow payments on partially paid contributions. Both were out of scope here.

@civibot
Copy link

civibot bot commented Jul 9, 2020

(Standard links)

@civibot civibot bot added the master label Jul 9, 2020
@agh1 agh1 changed the title [WIP] dev/financial#139 contribution receive_date shouldn't change unless it [WIP] dev/financial#139 contribution receive_date shouldn't change when payments come in Jul 9, 2020
@agh1 agh1 force-pushed the dontchangereceivedate branch 2 times, most recently from 1210d64 to 9bae1e1 Compare July 27, 2020 18:45
@agh1 agh1 force-pushed the dontchangereceivedate branch from 9bae1e1 to 5d9f801 Compare July 27, 2020 20:50
@agh1 agh1 changed the title [WIP] dev/financial#139 contribution receive_date shouldn't change when payments come in dev/financial#139 contribution receive_date shouldn't change when payments come in Jul 27, 2020
@agh1
Copy link
Contributor Author

agh1 commented Jul 28, 2020

Jenkins retest this please

@eileenmcnaughton
Copy link
Contributor

I tested this and it works. The button name is wrong - but I can do a follow up PR and I think it would be better to allow the payment amount to be altered - that can also be a follow up.

More seriously we have lost some functionality - ie the ability to bulk update from Pending to Failed / Cancelled.

There are so many issues with the code & functionality for that that I don't know how to start - however, the question remains - does anyone actually use it?

There is also so much good in this PR from a code maintainability point of view and more reliable clearer functionality.

I'm going to merge this but @agh1 I think we still need something - a blog? dunno - to try to surface if people use this for cancel / fail and perhaps a way to highlight this change / that functionality loss. I could probably put together an extension to replace it - but it's also possible no-one ever uses it...

@eileenmcnaughton eileenmcnaughton merged commit 1507408 into civicrm:master Jul 30, 2020
@agh1
Copy link
Contributor Author

agh1 commented Jul 30, 2020 via email

@eileenmcnaughton
Copy link
Contributor

@agh1 OK - I guess it should be highlighted when we do the release too

agileware-justin pushed a commit to agileware/civicrm-end-user-guide that referenced this pull request Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants