From 3bec874f09957589e5aec0e09240ea364bf6e092 Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 31 Aug 2019 16:41:16 +1200 Subject: [PATCH] [REF] Very minor code cleanup on import. The value is equal to the phone id if one exists or the processor id - this just uses the processor function to grab it --- CRM/Contact/Import/Form/MapField.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index 7cab30413d..96c1b9f80f 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -886,6 +886,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { $locationId = $processor->getLocationTypeID($i); $phoneType = $processor->getPhoneTypeID($i); $imProvider = $processor->getIMProviderID($i); + $typeId = $processor->getPhoneOrIMTypeID($i); if ($websiteTypeId) { $defaults["mapper[$i]"] = [$relation, $contactDetails, $websiteTypeId]; @@ -894,14 +895,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { } } else { - // default for IM/phone when mapping with relation is true - $typeId = NULL; - if (isset($phoneType)) { - $typeId = $phoneType; - } - elseif (isset($imProvider)) { - $typeId = $imProvider; - } + $defaults["mapper[$i]"] = [$relation, $contactDetails, $locationId, $typeId]; if (!$locationId) { $js .= "{$formName}['mapper[$i][2]'].style.display = 'none';\n"; @@ -928,6 +922,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { $locationId = $processor->getLocationTypeID($i); $phoneType = $processor->getPhoneTypeID($i); $imProvider = $processor->getIMProviderID($i); + $typeId = $processor->getPhoneOrIMTypeID($i); if ($websiteTypeId) { $defaults["mapper[$i]"] = [$mappingHeader[0], $websiteTypeId]; @@ -937,13 +932,6 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { $js .= "{$formName}['mapper[$i][1]'].style.display = 'none';\n"; } //default for IM/phone without related contact - $typeId = NULL; - if (isset($phoneType)) { - $typeId = $phoneType; - } - elseif (isset($imProvider)) { - $typeId = $imProvider; - } $defaults["mapper[$i]"] = [$mappingHeader[0] ?? '', $locationId, $typeId]; } -- 2.25.1