From 7597b96ea93d12cf19069d0511a00a8ac1f9b9bc Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Thu, 3 Dec 2015 14:59:35 +1300 Subject: [PATCH] CRM-17653 save contribution_recur_id to back office contribution on recurring renewal --- CRM/Member/BAO/Membership.php | 1 + CRM/Member/Form/MembershipRenewal.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 118d0de8f8..037fa04d1e 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -2966,6 +2966,7 @@ WHERE civicrm_membership.is_test = 0"; 'membership_id', 'tax_amount', 'skipLineItem', + 'contribution_recur_id', ); foreach ($recordContribution as $f) { $contributionParams[$f] = CRM_Utils_Array::value($f, $params); diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index fdc6fa37d5..7cf178d894 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -507,7 +507,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; */ public function postProcess() { - $ids = array(); + $contributionRecurID = NULL; $config = CRM_Core_Config::singleton(); // get the submitted form values. @@ -616,7 +616,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; if (!empty($paymentParams['auto_renew'])) { $contributionRecurParams = $this->processRecurringContribution($paymentParams); - $this->_params['contributionRecurID'] = $contributionRecurParams['contributionRecurID']; + $contributionRecurID = $this->_params['contributionRecurID'] = $contributionRecurParams['contributionRecurID']; $paymentParams = array_merge($paymentParams, $contributionRecurParams); } $result = $payment->doDirectPayment($paymentParams); @@ -735,7 +735,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; // not a great pattern & ideally it would not receive as a reference. We assign our params as a // temporary variable to avoid e-notice & to make it clear to future refactorer that // this function is NOT reliant on that var being set - $temporaryParams = array_merge($formValues, array('membership_id' => $renewMembership->id)); + $temporaryParams = array_merge($formValues, array('membership_id' => $renewMembership->id, 'contribution_recur_id' => $contributionRecurID)); CRM_Member_BAO_Membership::recordMembershipContribution($temporaryParams); } -- 2.25.1