From 08086255592a9106e780f444d116ddd629719a5e Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 11 Jun 2022 11:09:20 +1200 Subject: [PATCH] dev/core#3512 fix rc fatal error when state is invalid --- CRM/Contact/Import/Parser/Contact.php | 3 +++ .../Form/data/individual_country_state_county_with_related.csv | 1 + 2 files changed, 4 insertions(+) diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 137d61d88a..3c2b5a82b0 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -1785,6 +1785,9 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { * @throws \Civi\API\Exception\UnauthorizedException */ private function tryToResolveStateProvince(string $stateProvince, $countryID) { + if ($stateProvince === 'invalid_import_value') { + return $stateProvince; + } // Try to disambiguate since we likely have the country now. $possibleStates = $this->ambiguousOptions['state_province_id'][mb_strtolower($stateProvince)]; if ($countryID) { diff --git a/tests/phpunit/CRM/Contact/Import/Form/data/individual_country_state_county_with_related.csv b/tests/phpunit/CRM/Contact/Import/Form/data/individual_country_state_county_with_related.csv index 42a7d224db..203431d3a8 100644 --- a/tests/phpunit/CRM/Contact/Import/Form/data/individual_country_state_county_with_related.csv +++ b/tests/phpunit/CRM/Contact/Import/Form/data/individual_country_state_county_with_related.csv @@ -6,3 +6,4 @@ Susie,Jones,susie@example.com,,AU,New South Wales,New South Wales,AU,AU,New Sout Susie,Jones,susie@example.com,,1013,New South Wales,,1013,1013,New South Wales,Mum,Jones,mum@example.com,New South Wales,1013,,1013,New South Wales,1013,New South Wales,Valid, Susie,Jones,susie@example.com,,AUSTRALIA,,,,,,Mum,Jones,mum@example.com,,austRalia,,,,,,Valid, Susie,Jones,susie@example.com,,AU,NEW South Wales,NEW South Wales,AU,AU,NEW South Wales,Mum,Jones,mum@example.com,NEW South Wales,AU,,AU,NEW South Wales,Australia,NEW South Wales,Valid, +Susie,Jones,susie@example.com,,AU,My own personal fiefdom,My own personal fiefdom,AU,AU,My own personal fiefdom,Mum,Jones,mum@example.com,My own personal fiefdom,AU,,AU,My own personal fiefdom,Australia,My own personal fiefdom,Invalid,rando -- 2.25.1