From 4b87bd021964c3b1fea47c225e13186d7ef8a7b4 Mon Sep 17 00:00:00 2001 From: monishdeb Date: Mon, 18 Nov 2013 19:19:46 +0530 Subject: [PATCH] CRM-13780 fix - Don't allow users to attempt to merge the Default Organization into another organization http://issues.civicrm.org/jira/browse/CRM-13780 --- CRM/Contact/Form/Merge.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CRM/Contact/Form/Merge.php b/CRM/Contact/Form/Merge.php index c305672e43..c0fc66d172 100644 --- a/CRM/Contact/Form/Merge.php +++ b/CRM/Contact/Form/Merge.php @@ -293,6 +293,15 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { } $this->addButtons($button); + $this->addFormRule(array('CRM_Contact_Form_Merge', 'formRule'), $this); + } + + static function formRule($fields, $files, $self) { + $errors = array(); + if (CRM_Contact_BAO_Contact::checkDomainContact($self->_oid)) { + $errors['_qf_default'] = ts("The Default Organization contact cannot be merged into another contact record. It is associated with the CiviCRM installation for this domain and contains information used for system functions. If you want to merge these records, you can click the link to Flip between the original and duplicate contacts and then continue with the merge.", array(1 => CRM_Utils_System::url('civicrm/contact/merge', 'reset=1&action=update&cid=' . $self->_oid . '&oid=' . $self->_cid . '&rgid=' . $self->_rgid . '&flip=1'))); + } + return $errors; } public function postProcess() { -- 2.25.1