From 78b795496ed82be6e4de95a5d537b83fdfd797b9 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 29 May 2013 02:09:45 +0530 Subject: [PATCH] -- fixed for CRM-12699 ---------------------------------------- * CRM-12699: Total_Amount field is incorrectly recorded as 0 for repeating credit card contribs. http://issues.civicrm.org/jira/browse/CRM-12699 --- CRM/Contribute/Form/Contribution.php | 3 ++- CRM/Core/BAO/FinancialTrxn.php | 3 +++ CRM/Core/Payment/BaseIPN.php | 1 + CRM/Member/Form/Membership.php | 19 ------------------- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 0253899e4d..b42af2d888 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1388,7 +1388,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP ); //get the payment processor id as per mode. - $params['payment_processor_id'] = $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id']; + $this->_params['payment_processor'] = $params['payment_processor_id'] = + $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id']; $now = date('YmdHis'); $fields = array(); diff --git a/CRM/Core/BAO/FinancialTrxn.php b/CRM/Core/BAO/FinancialTrxn.php index 95a675df66..90109b33bd 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -336,6 +336,9 @@ WHERE ceft.entity_id = %1"; $amount = $params['prevContribution']->fee_amount; } $amount = $params['fee_amount'] - $amount; + if (!$amount) { + return FALSE; + } $financialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $expenseTypeId); $params['trxnParams']['from_financial_account_id'] = $params['to_financial_account_id']; $params['trxnParams']['to_financial_account_id'] = $financialAccount; diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index accdaf5153..cb96a8b48a 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -487,6 +487,7 @@ LIMIT 1;"; $input['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatuses)) { $input['payment_processor'] = $paymentProcessorId; } + $input['contribution_status_id'] = array_search('Completed', $contributionStatuses); $input['total_amount'] = $input['amount']; $input['contribution'] = $contribution; $input['financial_type_id'] = $contribution->financial_type_id; diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index a66dcdfb85..8b22bf1dbf 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -1511,25 +1511,6 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $count++; } - if (!CRM_Utils_Array::value('is_recur', $params) && $params['total_amount'] > 0.0) { - $contribution = new CRM_Contribute_BAO_Contribution(); - $contribution->trxn_id = CRM_Utils_Array::value('trxn_id', $result); - if ($contribution->find(TRUE)) { - // next create the transaction record - $trxnParams = array( - 'contribution_id' => $contribution->id, - 'trxn_date' => $now, - 'trxn_type' => 'Debit', - 'total_amount' => $params['total_amount'], - 'fee_amount' => CRM_Utils_Array::value('fee_amount', $result), - 'net_amount' => CRM_Utils_Array::value('net_amount', $result, $params['total_amount']), - 'currency' => $config->defaultCurrency, - 'payment_processor' => $this->_paymentProcessor['payment_processor_type'], - 'trxn_id' => CRM_Utils_Array::value('trxn_id', $result), - ); - $trxn = CRM_Core_BAO_FinancialTrxn::create($trxnParams); - } - } } else { $params['action'] = $this->_action; -- 2.25.1