From 9b96584d417a8d438a05e9abec8f0ee30fea91ef Mon Sep 17 00:00:00 2001 From: JKingsnorth Date: Thu, 28 Apr 2016 16:07:18 +0100 Subject: [PATCH] CRM-18480: Don't allow 'deleted' contacts to be merged --- CRM/Dedupe/Merger.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index a983913124..eec229b6af 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -993,6 +993,12 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m if (empty($result['values'][$cid]['contact_type'])) { return FALSE; } + + // CRM-18480: Cancel the process if the contact is already deleted + if (isset($result['values'][$cid]['contact_is_deleted']) && !empty($result['values'][$cid]['contact_is_deleted'])) { + CRM_Core_Error::fatal(ts('Cannot merge because the \'%1\' contact (ID %2) has been deleted.', array(1 => $moniker, 2 => $cid))); + } + $$moniker = $result['values'][$cid]; } @@ -1834,7 +1840,6 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m $contactFields = CRM_Contact_DAO_Contact::fields(); $invalidFields = array( 'api_key', - 'contact_is_deleted', 'created_date', 'display_name', 'hash', -- 2.25.1