From: Eileen McNaughton Date: Wed, 18 May 2022 00:02:50 +0000 (+1200) Subject: Set up related Contact Key earlier X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=adac7ed9e972ae3cf7623cf42d40bdc05da561ba;p=civicrm-core.git Set up related Contact Key earlier --- 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; }