From dfa2f16c836659a5122ee2524246083e465bca87 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 20 Apr 2022 22:54:35 +1200 Subject: [PATCH] [Import] Rename dedupe rule id field from dedupe to dedupe_rule_id field It is still dedupe internally as those places will 'age out' --- CRM/Contact/Import/Form/DataSource.php | 25 +++++++++---------- CRM/Contact/Import/Form/MapField.php | 2 +- CRM/Contact/Import/Form/Preview.php | 2 +- CRM/Import/Forms.php | 4 +++ .../CRM/Contact/Import/Form/DataSource.tpl | 12 ++++----- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/CRM/Contact/Import/Form/DataSource.php b/CRM/Contact/Import/Form/DataSource.php index d956721ad7..b39b674010 100644 --- a/CRM/Contact/Import/Form/DataSource.php +++ b/CRM/Contact/Import/Form/DataSource.php @@ -111,7 +111,7 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Import_Forms { $this->addRadio('contactType', ts('Contact Type'), $contactTypeOptions, [], NULL, FALSE, $contactTypeAttributes); $this->addElement('select', 'subType', ts('Subtype')); - $this->addElement('select', 'dedupe', ts('Dedupe Rule')); + $this->addElement('select', 'dedupe_rule_id', ts('Dedupe Rule')); CRM_Core_Form_Date::buildAllowedDateFormats($this); @@ -182,19 +182,18 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Import_Forms { $this->_params = $this->controller->exportValues($this->_name); $storeParams = [ - 'onDuplicate' => $this->exportValue('onDuplicate'), - 'dedupe' => $this->exportValue('dedupe'), - 'contactType' => $this->exportValue('contactType'), - 'contactSubType' => $this->exportValue('subType'), - 'dateFormats' => $this->exportValue('dateFormats'), - 'savedMapping' => $this->exportValue('savedMapping'), + 'onDuplicate' => $this->getSubmittedValue('onDuplicate'), + 'dedupe' => $this->getSubmittedValue('dedupe_rule_id'), + 'contactType' => $this->getSubmittedValue('contactType'), + 'contactSubType' => $this->getSubmittedValue('subType'), + 'dateFormats' => $this->getSubmittedValue('dateFormats'), + 'savedMapping' => $this->getSubmittedValue('savedMapping'), ]; foreach ($storeParams as $storeName => $value) { $this->set($storeName, $value); } - $this->set('disableUSPS', !empty($this->_params['disableUSPS'])); - + $this->set('disableUSPS', $this->getSubmittedValue('disableUSPS')); $this->set('dataSource', $this->getSubmittedValue('dataSource')); $this->set('skipColumnHeader', CRM_Utils_Array::value('skipColumnHeader', $this->_params)); @@ -216,16 +215,16 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Import_Forms { $parser->setMaxLinesToProcess(100); $parser->setUserJobID($this->getUserJobID()); $parser->run($importTableName, - $mapper, + [], CRM_Import_Parser::MODE_MAPFIELD, - $storeParams['contactType'], + $this->getSubmittedValue('contactType'), '_id', '_status', CRM_Import_Parser::DUPLICATE_SKIP, NULL, NULL, FALSE, CRM_Contact_Import_Parser_Contact::DEFAULT_TIMEOUT, - $storeParams['contactSubType'], - $storeParams['dedupe'] + $this->getSubmittedValue('contactSubType'), + $this->getSubmittedValue('dedupe_rule_id') ); // add all the necessary variables to the form diff --git a/CRM/Contact/Import/Form/MapField.php b/CRM/Contact/Import/Form/MapField.php index acd0ce187f..f619d5bdf0 100644 --- a/CRM/Contact/Import/Form/MapField.php +++ b/CRM/Contact/Import/Form/MapField.php @@ -707,7 +707,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { NULL, NULL, FALSE, CRM_Contact_Import_Parser_Contact::DEFAULT_TIMEOUT, $this->get('contactSubType'), - $this->get('dedupe') + $this->getSubmittedValue('dedupe_rule_id') ); return $parser; } diff --git a/CRM/Contact/Import/Form/Preview.php b/CRM/Contact/Import/Form/Preview.php index 02816642ab..b65467c144 100644 --- a/CRM/Contact/Import/Form/Preview.php +++ b/CRM/Contact/Import/Form/Preview.php @@ -214,7 +214,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview { 'invalidRowCount' => $this->get('invalidRowCount'), 'conflictRowCount' => $this->get('conflictRowCount'), 'onDuplicate' => $this->get('onDuplicate'), - 'dedupe' => $this->get('dedupe'), + 'dedupe' => $this->getSubmittedValue('dedupe_rule_id'), 'newGroupName' => $this->controller->exportValue($this->_name, 'newGroupName'), 'newGroupDesc' => $this->controller->exportValue($this->_name, 'newGroupDesc'), 'newGroupType' => $this->controller->exportValue($this->_name, 'newGroupType'), diff --git a/CRM/Import/Forms.php b/CRM/Import/Forms.php index b1fc3a4d66..938f8f5f6d 100644 --- a/CRM/Import/Forms.php +++ b/CRM/Import/Forms.php @@ -104,9 +104,13 @@ class CRM_Import_Forms extends CRM_Core_Form { 'fieldSeparator' => 'DataSource', 'uploadFile' => 'DataSource', 'contactType' => 'DataSource', + 'contactSubType' => 'DataSource', 'dateFormats' => 'DataSource', 'savedMapping' => 'DataSource', 'dataSource' => 'DataSource', + 'dedupe_rule_id' => 'DataSource', + 'onDuplicate' => 'DataSource', + 'disableUSPS' => 'DataSource', ]; /** diff --git a/templates/CRM/Contact/Import/Form/DataSource.tpl b/templates/CRM/Contact/Import/Form/DataSource.tpl index 58e4d29f85..57b7ff515a 100644 --- a/templates/CRM/Contact/Import/Form/DataSource.tpl +++ b/templates/CRM/Contact/Import/Form/DataSource.tpl @@ -43,8 +43,8 @@ {$form.onDuplicate.html} {help id='dupes'} - {$form.dedupe.label} - {$form.dedupe.html} {help id='id-dedupe_rule'} + {$form.dedupe_rule_id.label} + {$form.dedupe_rule_id.html} {help id='id-dedupe_rule'} {$form.fieldSeparator.label} @@ -151,16 +151,16 @@ success: function(dedupe){ if ( dedupe.length == 0 ) { - cj("#dedupe").empty(); + cj("#dedupe_rule_id").empty(); cj("#contact-dedupe").hide(); } else { cj("#contact-dedupe").show(); - cj("#dedupe").empty(); + cj("#dedupe_rule_id").empty(); - cj("#dedupe").append(""); + cj("#dedupe_rule_id").append(""); for ( var key in dedupe ) { // stick these new options in the dedupe select - cj("#dedupe").append(""); + cj("#dedupe_rule_id").append(""); } } -- 2.25.1