-
-
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
CRM-21183: Updating Partially paid contribution to Completed doesn't … #10981
Conversation
…update membership
CRM/Contribute/BAO/Contribution.php
Outdated
|
||
// only pending contribution related object processed. | ||
if ($previousContriStatusId && | ||
($previousContriStatusId != array_search('Pending', $contributionStatuses)) | ||
(!in_array($previousContriStatusId, array($pending, $partaillyPaid))) |
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.
how about (!in_array($contributionStatuses[$previousContriStatusId], array('Pending', 'Partially paid'))) ??
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.
Done 👍
//Update contribution to Partially paid. | ||
$prevContribution = $this->callAPISuccess('Contribution', 'create', array( | ||
'id' => $contribution['contribution_id'], | ||
'contribution_status_id' => 8, |
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.
Can use labels??
$form = new CRM_Contribute_Form_Contribution(); | ||
$submitParams = array( | ||
'id' => $contribution['contribution_id'], | ||
'contribution_status_id' => 1, |
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.
Can use labels??
f0cabfd
to
41170ff
Compare
41170ff
to
1e9b7f9
Compare
Stylistically I think it's better to resolve $previousContributionStatus early on when we are looking at it more than& compare that - ie $previousContributionStatus = CRM_Core_Pseudoconstant:::getName('CRM_Contribution_BAO_Contribution', 'contribution_status_id', $contributionStatuses[$previousContriStatusId]); & From then on if ($previousContributionStatus === 'Pending') etc Overall I think this can be merged once @pradpnayak OKs it - |
I will QA and post my result by tomorrow. |
thanks |
I would note there is additional discussion about this PR on JIRA |
Test case 2:
|
Thanks for the review comments @pradpnayak. Following my comment on the issue, API's too doesn't support the update of membership with status, even with Not sure what the exact behaviour should be in case of API, but I've seen places which use Re this PR - it only extends the existing functionality which was working for |
@pradpnayak I'm having trouble interpreting your review. You say "The patch works fine" but then identify some issues. Is this
If this is fixing something & not making other things worse I lean towards merge as it locks in the fix with a unit test. However, I don't want to merge something that is a step backwards |
@eileenmcnaughton The patch works fine when contribution status is changed from UI, membership status is changed correctly. However when we change the status of contribution using Contribution api the status of membership is not changed i.e the patch works as expected when status change done through UI form but not through api call. The other issue i noticed during the test was no payment was recorded when status was changed to Completed from Partially paid. As @JoeMurray mentioned in issue that we need to stop this type of transitions i.e changing Partially paid contribution to completed directly. But i believe you or @monishdeb will be covering this fix in #10776 and forcing user to record payment for contribution status like Pending, Partially paid, Pending refund rather changing the status directly. |
@pradpnayak so does that mean this is a partial fix & should be merged on that basis? (I agree that the completetransaction api is IMHO the only reliable way to change the status of a contribution to Completed) |
Yes agreed, this is safe to merge. |
thanks! |
:)
|
…update membership
Overview
Update membership when contribution is updated from partially paid to completed.
Before
Membership is unaffected when related contribution is updated from partially paid to completed.
After
Membership is updated to New or its calculated status in above case.
Technical Details
Current functionality handles the contribution status switch between
Pending -> Completed
. It should also considerPartially paid
status.Comments
Unit test added.