From 5072c8946282fb50193e5e10aecabbf597645328 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 12 Mar 2021 10:39:59 +1300 Subject: [PATCH] [Ref] Remove copy and paste overkill 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 --- CRM/Member/Form/Membership.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index cf01671909..04292a051c 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -1819,8 +1819,6 @@ DESC limit 1"); $params, $contributionParams ) { - $form = $this; - $transaction = new CRM_Core_Transaction(); $contactID = $contributionParams['contact_id']; // add these values for the recurringContrib function ,CRM-10188 @@ -1833,13 +1831,7 @@ DESC limit 1"); $contributionParams['contribution_recur_id'] = $recurringContributionID; } - $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); } /** -- 2.25.1