Skip to content

Commit

Permalink
[Ref] Remove copy and paste overkill
Browse files Browse the repository at this point in the history
This is a previously shared function that was copied and pasted back. However in the
context of this form they don't make sense because

1) It doesn't make sense to try to maintain the integrity (via the transaction)
of the contribution & recurring contribution over & above the other
items on the form - without the memberships they don't actually have integrity
and this might have made a little more sense front end in terms
of ensuring they were committed if a payment is made but
we can expect a back office user to observe an error

2) setting the contribution id on the form here doesn't make sense as
this line is only hit for credit-card recurring contributions and
either we are doing it elsewhere anyway or we should do it nowhere - there
is no logic for 'only do this in this one obscure flow' that makes
sense back office. Front office this was likely added for an otherwise missed
scenario
  • Loading branch information
eileenmcnaughton committed Mar 11, 2021
1 parent d5a0c3c commit 3f02daa
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions CRM/Member/Form/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -1816,8 +1816,6 @@ protected function processContribution(
$params,
$contributionParams
) {
$form = $this;
$transaction = new CRM_Core_Transaction();
$contactID = $contributionParams['contact_id'];

// add these values for the recurringContrib function ,CRM-10188
Expand All @@ -1841,13 +1839,7 @@ protected function processContribution(
// @todo this is the wrong place for this - it should be done as close to form submission
// as possible
$contributionParams['total_amount'] = $params['amount'];
$contribution = CRM_Contribute_BAO_Contribution::add($contributionParams);

// lets store it in the form variable so postProcess hook can get to this and use it
$form->_contributionID = $contribution->id;

$transaction->commit();
return $contribution;
return CRM_Contribute_BAO_Contribution::add($contributionParams);
}

/**
Expand Down

0 comments on commit 3f02daa

Please sign in to comment.