From f96471b37374b7d3afe40e01f37921e33b6f3f3b Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 3 Apr 2023 13:03:08 +1200 Subject: [PATCH] Fix to validation error for invalid campaign --- CRM/Import/Parser.php | 2 +- tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Import/Parser.php b/CRM/Import/Parser.php index 0ccf1f8a0c..05a6c65aed 100644 --- a/CRM/Import/Parser.php +++ b/CRM/Import/Parser.php @@ -1651,7 +1651,7 @@ abstract class CRM_Import_Parser implements UserJobInterface { $campaign = Campaign::get()->addClause('OR', ['title', '=', $importedValue], ['name', '=', $importedValue], ['id', '=', $importedValue])->addSelect('id')->execute()->first(); Civi::$statics[__CLASS__][$fieldName][$importedValue] = $campaign['id'] ?? FALSE; } - return Civi::$statics[__CLASS__][$fieldName][$importedValue] ?? 'invalid_import_value'; + return Civi::$statics[__CLASS__][$fieldName][$importedValue] ?: 'invalid_import_value'; } } if ($dataType === 'Integer') { diff --git a/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php b/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php index 4616bdf06c..87cea9c4d9 100644 --- a/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/Import/Parser/ContributionTest.php @@ -664,7 +664,7 @@ class CRM_Contribute_Import_Parser_ContributionTest extends CiviUnitTestCase { ['name' => ''], ['name' => ''], ['name' => 'trxn_id'], - ['name' => 'contribution_campaign_id'], + ['name' => 'campaign_id'], ]; // First we try to create without total_amount mapped. // It will fail in create mode as total_amount is required for create. -- 2.25.1