From: eileen Date: Fri, 6 Sep 2019 00:18:56 +0000 (+1200) Subject: Use shared function to add mapping form now dependencies are gone X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=27a00f6b2ce7aa698ab4f9ba5cec329f3929ec85;p=civicrm-core.git Use shared function to add mapping form now dependencies are gone --- diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index 79bd3321a4..0d2d3ce56e 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -198,39 +198,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { */ public function buildQuickForm() { $savedMappingID = (int) $this->get('savedMapping'); - //to save the current mappings - if (!$savedMappingID) { - $saveDetailsName = ts('Save this field mapping'); - $this->applyFilter('saveMappingName', 'trim'); - $this->add('text', 'saveMappingName', ts('Name')); - $this->add('text', 'saveMappingDesc', ts('Description')); - } - else { - $savedMapping = $this->get('savedMapping'); - - list($mappingName) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping, TRUE); - - //get loaded Mapping Fields - $mappingName = CRM_Utils_Array::value(1, $mappingName); - - $this->assign('loadedMapping', $savedMapping); - $this->set('loadedMapping', $savedMapping); - - $params = ['id' => $savedMapping]; - $temp = []; - $mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp); - - $this->assign('savedName', $mappingDetails->name); - - $this->add('hidden', 'mappingId', $savedMapping); - - $this->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL); - $saveDetailsName = ts('Save as a new field mapping'); - $this->add('text', 'saveMappingName', ts('Name')); - $this->add('text', 'saveMappingDesc', ts('Description')); - } - - $this->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, ['onclick' => "showSaveDetails(this)"]); + $this->buildSavedMappingFields($savedMappingID); $this->addFormRule(['CRM_Contact_Import_Form_MapField', 'formRule']); diff --git a/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php b/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php index ceea85bb7f..500a5fc74c 100644 --- a/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php +++ b/tests/phpunit/CRM/Contact/Import/Form/MapFieldTest.php @@ -365,8 +365,6 @@ document.forms.MapField['mapper[0][3]'].style.display = 'none';\n", * * This signature of the function we are calling is funky as a new extraction & will be refined. * - * @param \CRM_Contact_Import_Form_MapField $form - * * @param int $mappingID * @param int $columnNumber *