From 090a3abddf9ce67847a3dd78a6dff780aebf7e59 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 31e04c38d3d0..d09ac055180b 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -685,10 +685,10 @@ public static function createDeferredTrxn($lineItems, $contributionDetails, $upd } 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 e485c85e8333..c2ca619c11e0 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php @@ -1275,7 +1275,7 @@ public function testContributionWithDeferredRevenue() { $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(