Merge pull request #23464 from eileenmcnaughton/import_on_dup
[civicrm-core.git] / CRM / Contact / Import / Parser / Contact.php
index 874ad018c43fd2ea02c39c50dcbf965bb96628b0..fb11bdabe5a56c6967a5d7fccef48fc22b9b5527 100644 (file)
@@ -2339,8 +2339,6 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser {
       $relatedContactType = $this->getRelatedContactType($mappedField['relationship_type_id'], $mappedField['relationship_direction']);
       $relatedContactLocationTypeID = $relatedContactKey ? $mappedField['location_type_id'] : NULL;
       $relatedContactWebsiteTypeID = $relatedContactKey ? $mappedField['website_type_id'] : NULL;
-      $relatedContactIMProviderID = $relatedContactKey ? $mappedField['provider_id'] : NULL;
-      $relatedContactPhoneTypeID = $relatedContactKey ? $mappedField['phone_type_id'] : 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)));
@@ -2375,27 +2373,12 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser {
           ) {
             $params[$relatedContactKey][$relatedContactFieldName] = [];
           }
-          $value = [
-            $relatedContactFieldName => $importedValue,
-            'location_type_id' => $relatedContactLocationTypeID,
-          ];
-
-          if (isset($relatedContactPhoneTypeID)) {
-            $value['phone_type_id'] = $relatedContactPhoneTypeID;
-          }
-
-          // get IM service Provider type id for related contact
-          if (isset($relatedContactIMProviderID)) {
-            $value['provider_id'] = $relatedContactIMProviderID;
-          }
-
+          $value[$relatedContactFieldName] = $importedValue;
           $params[$relatedContactKey][$relatedContactFieldName][] = $value;
         }
         elseif (isset($relatedContactWebsiteTypeID)) {
-          $params[$relatedContactKey][$relatedContactFieldName][] = [
-            'url' => $importedValue,
-            'website_type_id' => $relatedContactWebsiteTypeID,
-          ];
+          $value[$relatedContactFieldName] = $importedValue;
+          $params[$relatedContactKey][$relatedContactFieldName][] = $value;
         }
         elseif (empty($importedValue) && isset($relatedContactLocationTypeID)) {
           if (empty($params[$relatedContactKey][$relatedContactFieldName])) {