From 748f4d17b860c9e5cf4b91ee5c09a5abfe54e54b Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 18 May 2022 12:01:40 +1200 Subject: [PATCH] Further simplification --- 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 d9a039b54f..b3cf391dc1 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -2329,12 +2329,11 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { foreach ($this->getFieldMappings() as $i => $mappedField) { // The key is in the format 5_a_b where 5 is the relationship_type_id and a_b is the direction. $relatedContactKey = $mappedField['relationship_type_id'] ? ($mappedField['relationship_type_id'] . '_' . $mappedField['relationship_direction']) : NULL; - $fieldName = $relatedContactKey ? NULL : $mappedField['name']; + $fieldName = $mappedField['name']; $importedValue = $values[$i]; if ($fieldName === 'do_not_import' || $importedValue === NULL) { continue; } - $relatedContactFieldName = $relatedContactKey ? $mappedField['name'] : NULL; $locationFields = ['location_type_id', 'phone_type_id', 'provider_id', 'website_type_id']; $value = array_filter(array_intersect_key($mappedField, array_fill_keys($locationFields, 1))); @@ -2360,10 +2359,10 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { } if (!empty($value)) { - $params[$relatedContactKey][$relatedContactFieldName][] = $importedValue ? [] : $value; + $params[$relatedContactKey][$fieldName][] = $importedValue ? [] : $value; } else { - $params[$relatedContactKey][$relatedContactFieldName] = $importedValue; + $params[$relatedContactKey][$fieldName] = $importedValue; } } } -- 2.25.1