$this->_gid = $gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE);
$this->_mergeId = CRM_Utils_Request::retrieve('mergeId', 'Positive', $this, FALSE);
+ // Sanity check
+ if ($cid == $oid) {
+ CRM_Core_Error::statusBounce(ts('Cannot merge a contact with itself.'));
+ }
+
if (!CRM_Dedupe_BAO_Rule::validateContacts($cid, $oid)) {
CRM_Core_Error::statusBounce(ts('The selected pair of contacts are marked as non duplicates. If these records should be merged, you can remove this exception on the <a href=\'%1\'>Dedupe Exceptions</a> page.', array(1 => CRM_Utils_System::url('civicrm/dedupe/exception', 'reset=1'))));
}
CRM_Core_Error::fatal(ts('The other contact record does not exist'));
}
- $subtypes = CRM_Contact_BAO_ContactType::subTypePairs(NULL, TRUE, '');
-
$this->assign('contact_type', $main['contact_type']);
- if (!empty($main['contact_sub_type'])) {
- $this->assign('main_contact_subtype',
- CRM_Utils_Array::value($main['contact_sub_type'][0], $subtypes)
- );
- }
- if (!empty($other['contact_sub_type'])) {
- $this->assign('other_contact_subtype',
- CRM_Utils_Array::value($other['contact_sub_type'][0], $subtypes)
- );
- }
$this->assign('main_name', $main['display_name']);
$this->assign('other_name', $other['display_name']);
$this->assign('main_cid', $main['contact_id']);
CRM_Dedupe_Merger::moveAllBelongings($this->_cid, $this->_oid, $formValues);
- CRM_Core_Session::setStatus(ts('Contact id %1 has been updated and contact id %2 has been deleted.', array(1 => $this->_cid, 2 => $this->_oid)), ts('Contacts Merged'), 'success');
+ $name = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_cid, 'display_name');
+ $message = '<ul><li>' . ts('%1 has been updated.', array(1 => $name)) . '</li><li>' . ts('Contact ID %1 has been deleted.', array(1 => $this->_oid)) . '</li></ul>';
+ CRM_Core_Session::setStatus($message, ts('Contacts Merged'), 'success');
+
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_cid}");
if (!empty($formValues['_qf_Merge_submit'])) {
$listParamsURL = "reset=1&action=update&rgid={$this->_rgid}";