Skip to content

Commit

Permalink
[Import] Rename dedupe rule id field from dedupe to dedupe_rule_id field
Browse files Browse the repository at this point in the history
It is still dedupe internally as those places will 'age out'
  • Loading branch information
eileenmcnaughton committed Apr 21, 2022
1 parent 4a01628 commit dfa2f16
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
25 changes: 12 additions & 13 deletions CRM/Contact/Import/Form/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function buildQuickForm() {
$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);

Expand Down Expand Up @@ -182,19 +182,18 @@ public function postProcess() {
$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));

Expand All @@ -216,16 +215,16 @@ public function postProcess() {
$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
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Import/Form/MapField.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ public function submit($params, $mapperKeys) {
NULL, NULL, FALSE,
CRM_Contact_Import_Parser_Contact::DEFAULT_TIMEOUT,
$this->get('contactSubType'),
$this->get('dedupe')
$this->getSubmittedValue('dedupe_rule_id')
);
return $parser;
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Import/Form/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public function postProcess() {
'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'),
Expand Down
4 changes: 4 additions & 0 deletions CRM/Import/Forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@ protected function getUserJobSubmittedValues(): array {
'fieldSeparator' => 'DataSource',
'uploadFile' => 'DataSource',
'contactType' => 'DataSource',
'contactSubType' => 'DataSource',
'dateFormats' => 'DataSource',
'savedMapping' => 'DataSource',
'dataSource' => 'DataSource',
'dedupe_rule_id' => 'DataSource',
'onDuplicate' => 'DataSource',
'disableUSPS' => 'DataSource',
];

/**
Expand Down
12 changes: 6 additions & 6 deletions templates/CRM/Contact/Import/Form/DataSource.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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("<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>");
}
}

Expand Down

0 comments on commit dfa2f16

Please sign in to comment.