From d1aed9dc8cfccc9bed50b65b203374923f1e4a6d Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Sat, 31 Mar 2018 10:55:58 +0100 Subject: [PATCH] Make sure financial_type_id is properly assigned when non-recurring contribution is created. --- CRM/Contribute/BAO/Contribution/Utils.php | 4 ++-- CRM/Contribute/Form/Contribution/Confirm.php | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index 2b99789923..0b2c99b898 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -74,6 +74,8 @@ class CRM_Contribute_BAO_Contribution_Utils { // add some financial type details to the params list // if folks need to use it + //CRM-15297 deprecate contributionTypeID + $paymentParams['financial_type_id'] = $paymentParams['financialTypeID'] = $paymentParams['contributionTypeID'] = $financialType->id; //CRM-15297 - contributionType is obsolete - pass financial type as well so people can deprecate it $paymentParams['financialType_name'] = $paymentParams['contributionType_name'] = $form->_params['contributionType_name'] = $financialType->name; //CRM-11456 @@ -154,8 +156,6 @@ class CRM_Contribute_BAO_Contribution_Utils { } $paymentParams['contributionID'] = $contribution->id; - //CRM-15297 deprecate contributionTypeID - $paymentParams['financialTypeID'] = $paymentParams['contributionTypeID'] = $contribution->financial_type_id; $paymentParams['contributionPageID'] = $contribution->contribution_page_id; if (isset($paymentParams['contribution_source'])) { $paymentParams['source'] = $paymentParams['contribution_source']; diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index e72a6843f1..850c98a013 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -740,21 +740,18 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr * * Comments from previous refactor indicate doubt as to what was going on. * - * @param int $contributionTypeId + * @param int $financialTypeID * * @return null|string */ - public function wrangleFinancialTypeID($contributionTypeId) { - if (isset($paymentParams['financial_type'])) { - $contributionTypeId = $paymentParams['financial_type']; - } - elseif (!empty($this->_values['pledge_id'])) { - $contributionTypeId = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_Pledge', + public function wrangleFinancialTypeID($financialTypeID) { + if (empty($financialTypeID) && !empty($this->_values['pledge_id'])) { + $financialTypeID = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_Pledge', $this->_values['pledge_id'], 'financial_type_id' ); } - return $contributionTypeId; + return $financialTypeID; } /** -- 2.25.1