From: eileen Date: Wed, 4 Sep 2019 22:04:42 +0000 (+1200) Subject: Move default fetching to Processor class X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e013bf2029491e624c22960e0345155577a4166a;p=civicrm-core.git Move default fetching to Processor class --- diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index 21254b6a85..4b926c314f 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -886,14 +886,9 @@ 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]; - } - else { - - $defaults["mapper[$i]"] = [$relation, $contactDetails, $locationId, $typeId]; + $defaults["mapper[$i]"] = $processor->getSavedQuickformDefaultsForColumn($i); + if (!$websiteTypeId) { if (!$locationId) { $js .= "{$formName}['mapper[$i][2]'].style.display = 'none';\n"; } diff --git a/CRM/Import/ImportProcessor.php b/CRM/Import/ImportProcessor.php index 5640c837a9..035591c446 100644 --- a/CRM/Import/ImportProcessor.php +++ b/CRM/Import/ImportProcessor.php @@ -513,6 +513,12 @@ class CRM_Import_ImportProcessor { * @throws \CiviCRM_API3_Exception */ public function getSavedQuickformDefaultsForColumn($column) { + if ($this->getValidRelationshipKey($column)) { + if ($this->getWebsiteTypeID($column)) { + return [$this->getValidRelationshipKey($column), $this->getFieldName($column), $this->getWebsiteTypeID($column)]; + } + return [$this->getValidRelationshipKey($column), $this->getFieldName($column), $this->getLocationTypeID($column), $this->getPhoneOrIMTypeID($column)]; + } if ($this->getWebsiteTypeID($column)) { return [$this->getFieldName($column), $this->getWebsiteTypeID($column)]; }