From: Seamus Lee Date: Mon, 25 May 2020 10:44:03 +0000 (+1000) Subject: dev/core#1776 Ensure that all fee financial item transaction date is set to the recie... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=83a30437cfa4b203eda1a3e4c673c6980f173e49;p=civicrm-core.git dev/core#1776 Ensure that all fee financial item transaction date is set to the recieve date of the contribution --- diff --git a/CRM/Core/BAO/FinancialTrxn.php b/CRM/Core/BAO/FinancialTrxn.php index f3c242da19..e4aeae7bd2 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -417,7 +417,7 @@ WHERE ceft.entity_id = %1"; 'financial_account_id' => $financialAccount, 'contact_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', CRM_Core_Config::domainID(), 'contact_id'), 'created_date' => date('YmdHis'), - 'transaction_date' => date('YmdHis'), + 'transaction_date' => $params['trxnParams']['trxn_date'], 'amount' => $amount, 'description' => 'Fee', 'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Financial_BAO_FinancialItem', 'status_id', 'Paid'), diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index cceecd738e..bbc36f10a5 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -518,6 +518,10 @@ class api_v3_ContributionTest extends CiviUnitTestCase { ]; $contribution = $this->callAPISuccess('contribution', 'create', $params); + $financialItems = $this->callAPISuccess('FinancialItem', 'get', []); + foreach ($financialItems['values'] as $financialItem) { + $this->assertEquals(date('Y-m-d H:i:s', strtotime($contribution['values'][$contribution['id']]['receive_date'])), date('Y-m-d H:i:s', strtotime($financialItem['transaction_date']))); + } $lineItems = $this->callAPISuccess('line_item', 'get', [ 'entity_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution',