From 903dd9c26578ae6d8fd1f2f3667dadd3b8e09dcb Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sun, 2 Apr 2023 19:18:24 +1200 Subject: [PATCH] Fix error when importing a soft credit AND a note when currency not provided --- CRM/Contribute/Import/Parser/Contribution.php | 2 +- tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index 6f47c715d3..0a4705ff79 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -471,7 +471,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser { if (!empty($softCreditParams)) { if (empty($contributionParams['total_amount']) || empty($contributionParams['currency'])) { - $contributionParams = Contribution::get()->addSelect('total_amount', 'currency')->addWhere('id', '=', $contributionID)->execute()->first(); + $contributionParams = array_merge($contributionParams, Contribution::get()->addSelect('total_amount', 'currency')->addWhere('id', '=', $contributionID)->execute()->first()); } foreach ($softCreditParams as $softCreditParam) { $softCreditParam['contribution_id'] = $contributionID; diff --git a/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php b/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php index caaa624032..7ecfdc14f9 100644 --- a/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php @@ -112,7 +112,7 @@ class CRM_Contribute_Import_Parser_ContributionTest extends CiviUnitTestCase { ['name' => 'financial_type_id'], ['name' => 'external_identifier'], ['name' => 'soft_credit.contact.external_identifier', 'soft_credit_type_id' => 1], - ['name' => ''], + ['name' => 'note'], ]; $this->importCSV('contributions_amount_validate.csv', $mapping, ['onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP]); -- 2.25.1