CRM-17237: more fixes
authoryashodha <yashodha.chaku@webaccessglobal.com>
Mon, 21 Sep 2015 11:38:19 +0000 (17:08 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Mon, 21 Sep 2015 11:38:19 +0000 (17:08 +0530)
----------------------------------------
* CRM-17237: Add Dedupe Rule allows user to save invalid (empty) RESERVED rule
  https://issues.civicrm.org/jira/browse/CRM-17237

CRM/Contact/Form/DedupeRules.php

index d438080d3515cf83ab413c8ff90f6bca4e70724f..9550dfc696126e22d0e2ae1818709fef2ba4c0d1 100644 (file)
@@ -155,7 +155,7 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form {
     $errors = array();
     $fieldSelected = FALSE;
     for ($count = 0; $count < self::RULES_COUNT; $count++) {
-      if (!empty($fields["where_$count"])) {
+        if (!empty($fields["where_$count"]) || ($self->_defaults['is_reserved'] && !empty($self->_defaults["where_$count"]))) {
         $fieldSelected = TRUE;
         break;
       }
@@ -228,7 +228,7 @@ UPDATE civicrm_dedupe_rule_group
     }
 
     // lets skip updating of fields for reserved dedupe group
-    if ($rgDao->is_reserved) {
+    if ($this->_defaults['is_reserved']) {
       CRM_Core_Session::setStatus(ts("The rule '%1' has been saved.", array(1 => $rgDao->title)), ts('Saved'), 'success');
       return;
     }