Skip to content

Commit

Permalink
Deprecate creating partially paid contributions, other than by partia…
Browse files Browse the repository at this point in the history
…lly paying a contribution.

As #15706 signposts - creating a contribution with a status of 'Partially Paid'
is not actually a valid thing to do. There are no created financial_trxns & the balance is wrong. In some places the code does
this in conjunction with some parameters. These don't really work either. We need to deprecate & eliminate this flow.

I'm expecting some tests to fail & need fixing before this passes
  • Loading branch information
eileenmcnaughton committed Nov 15, 2019
1 parent 541a66b commit 859618c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ public static function add(&$params, $ids = []) {
}

$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
if ($contributionStatus === 'Partially paid' && empty($params['is_post_payment_create'])) {
CRM_Core_Error::deprecatedFunctionWarning('Setting status to partially paid other than by using Payment.create is deprecated and unreliable');
}
//if contribution is created with cancelled or refunded status, add credit note id
// do the same for chargeback - this entered the code 'accidentally' but moving it to here
// as part of cleanup maintains consistency.
Expand Down

0 comments on commit 859618c

Please sign in to comment.