From adac7ed9e972ae3cf7623cf42d40bdc05da561ba Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 18 May 2022 12:02:50 +1200 Subject: [PATCH] Set up related Contact Key earlier --- CRM/Contact/Import/Parser/Contact.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index b3cf391dc1..7cd690e084 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -2340,6 +2340,9 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { if (!empty($value)) { $value[$fieldName] = $importedValue; } + if ($relatedContactKey && !isset($params[$relatedContactKey])) { + $params[$relatedContactKey] = ['contact_type' => $this->getRelatedContactType($mappedField['relationship_type_id'], $mappedField['relationship_direction'])]; + } if (!$relatedContactKey) { if (!empty($value)) { if (!isset($params[$fieldName])) { @@ -2354,10 +2357,6 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { } else { - if (!isset($params[$relatedContactKey])) { - $params[$relatedContactKey] = ['contact_type' => $this->getRelatedContactType($mappedField['relationship_type_id'], $mappedField['relationship_direction'])]; - } - if (!empty($value)) { $params[$relatedContactKey][$fieldName][] = $importedValue ? [] : $value; } -- 2.25.1