Skip to content

Commit

Permalink
dev/core#1339 Dedupe screen check to carry across any data where the …
Browse files Browse the repository at this point in the history
…other contact has none by default.

This change in default means that if the contact to be deleted has data in a field and the contact to be kept does not the
checkbox loads as checked by default (so it's easier to keep too much data but harder to lose some.)

https://lab.civicrm.org/dev/core/issues/1339

The user can override by unchecking - this is just what is set on screen load
  • Loading branch information
eileenmcnaughton committed Oct 25, 2019
1 parent 55af4b2 commit 3d1d395
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
5 changes: 4 additions & 1 deletion CRM/Contact/Form/Merge.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,16 @@ public function preProcess() {
// @todo consider enabling if it is an add & defaulting to true.
$element[4] = array_merge((array) CRM_Utils_Array::value(4, $element, []), ['disabled' => TRUE]);
}
$this->addElement($element[0],
$newCheckBox = $this->addElement($element[0],
$element[1],
array_key_exists('2', $element) ? $element[2] : NULL,
array_key_exists('3', $element) ? $element[3] : NULL,
array_key_exists('4', $element) ? $element[4] : NULL,
array_key_exists('5', $element) ? $element[5] : NULL
);
if (!empty($element['is_checked'])) {
$newCheckBox->setChecked(TRUE);
}
}

// add related table elements
Expand Down
13 changes: 7 additions & 6 deletions CRM/Dedupe/Merger.php
Original file line number Diff line number Diff line change
Expand Up @@ -1109,12 +1109,13 @@ public static function getRowsElementsAndInfo($mainId, $otherId, $checkPermissio
// Display a checkbox to migrate, only if the values are different
if ($value != $main[$field]) {
$elements[] = [
'advcheckbox',
"move_$field",
NULL,
NULL,
NULL,
$value,
0 => 'advcheckbox',
1 => "move_$field",
2 => NULL,
3 => NULL,
4 => NULL,
5 => $value,
'is_checked' => (!isset($main[$field]) || $main[$field] === ''),
];
}

Expand Down

0 comments on commit 3d1d395

Please sign in to comment.