From f818aed574288827b47f399e39cae85ffa2e4751 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 17 May 2017 06:53:52 +0530 Subject: [PATCH] --CRM-20585, fixed financial trxn entry for deferred revenue CRM-20585, fixed jenkins style ---------------------------------------- * CRM-20585: Correct the from and to accounts for deferred revenue transactions https://issues.civicrm.org/jira/browse/CRM-20585 --- CRM/Core/BAO/FinancialTrxn.php | 4 ++-- tests/phpunit/CRM/Contribute/BAO/ContributionTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CRM/Core/BAO/FinancialTrxn.php b/CRM/Core/BAO/FinancialTrxn.php index 31e04c38d3..d09ac05518 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -685,10 +685,10 @@ WHERE ft.to_financial_account_id NOT IN ( " . implode(', ', $filteredFinancialAc } foreach ($results['values'] as $result) { if ($result['account_relationship'] == $accountRel) { - $trxnParams['to_financial_account_id'] = $result['financial_account_id']; + $trxnParams['from_financial_account_id'] = $result['financial_account_id']; } else { - $trxnParams['from_financial_account_id'] = $result['financial_account_id']; + $trxnParams['to_financial_account_id'] = $result['financial_account_id']; } } foreach ($deferredRevenue['revenue'] as $revenue) { diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php index e485c85e83..c2ca619c11 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php @@ -1275,7 +1275,7 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2"; $checkAgainst = array( 'financial_trxn_id.to_financial_account_id.name' => 'Deferred Revenue - Event Fee', 'financial_trxn_id.from_financial_account_id.name' => 'Event Fee', - 'financial_trxn_id' => '2' + 'financial_trxn_id' => '2', ); $result = $this->callAPISuccessGetSingle('EntityFinancialTrxn', array( 'return' => array( -- 2.25.1