[Import] Rename dedupe rule id field from dedupe to dedupe_rule_id field
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 20 Apr 2022 10:54:35 +0000 (22:54 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 21 Apr 2022 14:59:31 +0000 (02:59 +1200)
It is still dedupe internally as those places will 'age out'

CRM/Contact/Import/Form/DataSource.php
CRM/Contact/Import/Form/MapField.php
CRM/Contact/Import/Form/Preview.php
CRM/Import/Forms.php
templates/CRM/Contact/Import/Form/DataSource.tpl

index d956721ad7eea1ea1e703759b0182a602103b394..b39b67401094b425a1a38909cef0d80429bff792 100644 (file)
@@ -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
index acd0ce187ff9eec87a129763dcce97da5fb86c11..f619d5bdf0a8047c0b658e31d38b6b07680f0413 100644 (file)
@@ -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;
   }
index 02816642abb76646a73329ab15dddc1ebe8bf93f..b65467c14458e808e58bd49b6c002aaf04ba2a78 100644 (file)
@@ -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'),
index b1fc3a4d66c2d6ce5942e12f962b7e3a4bb099cc..938f8f5f6d58bc91e972fc3ed3e6f02adf497961 100644 (file)
@@ -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',
   ];
 
   /**
index 58e4d29f85ffc243a6c5311d5de1585202d91c3c..57b7ff515a06811cca0a9152c33d06e54dc6d84b 100644 (file)
@@ -43,8 +43,8 @@
              <td>{$form.onDuplicate.html} {help id='dupes'}</td>
          </tr>
          <tr class="crm-import-datasource-form-block-dedupe">
-             <td class="label">{$form.dedupe.label}</td>
-             <td><span id="contact-dedupe">{$form.dedupe.html}</span> {help id='id-dedupe_rule'}</td>
+             <td class="label">{$form.dedupe_rule_id.label}</td>
+             <td><span id="contact-dedupe_rule_id">{$form.dedupe_rule_id.html}</span> {help id='id-dedupe_rule'}</td>
          </tr>
          <tr class="crm-import-datasource-form-block-fieldSeparator">
              <td class="label">{$form.fieldSeparator.label}</td>
 
                         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("<option value=''>- {/literal}{ts escape='js'}select{/ts}{literal} -</option>");
+                                                       cj("#dedupe_rule_id").append("<option value=''>- {/literal}{ts escape='js'}select{/ts}{literal} -</option>");
                                                        for ( var key in  dedupe ) {
                                                            // stick these new options in the dedupe select
-                                                           cj("#dedupe").append("<option value="+key+">"+dedupe[key]+" </option>");
+                                                           cj("#dedupe_rule_id").append("<option value="+key+">"+dedupe[key]+" </option>");
                                                        }
                                                    }