CRM-18522 tests to attempt to reproduce the reported sql error.
[civicrm-core.git] / CRM / Dedupe / BAO / RuleGroup.php
index 56081b4036aaaded1578cceb4b41b6c8c898787b..a6ea3542fcd86b6ddca962c7d46d61926ddadac3 100644 (file)
@@ -44,6 +44,15 @@ class CRM_Dedupe_BAO_RuleGroup extends CRM_Dedupe_DAO_RuleGroup {
    */
   var $contactIds = array();
 
+  /**
+   * Set the contact IDs to restrict the dedupe to.
+   *
+   * @param array $contactIds
+   */
+  public function setContactIds($contactIds) {
+    $this->contactIds = $contactIds;
+  }
+
   /**
    * Params to dedupe against (queries against the whole contact set otherwise)
    */
@@ -142,10 +151,8 @@ class CRM_Dedupe_BAO_RuleGroup extends CRM_Dedupe_DAO_RuleGroup {
     if ($this->is_reserved &&
       CRM_Utils_File::isIncludable("CRM/Dedupe/BAO/QueryBuilder/{$this->name}.php")
     ) {
-      include_once "CRM/Dedupe/BAO/QueryBuilder/{$this->name}.php";
-      $class = "CRM_Dedupe_BAO_QueryBuilder_{$this->name}";
       $command = empty($this->params) ? 'internal' : 'record';
-      $queries = call_user_func(array($class, $command), $this);
+      $queries = call_user_func(array("CRM_Dedupe_BAO_QueryBuilder_{$this->name}", $command), $this);
     }
     else {
       // All other rule groups have queries generated by the member dedupe
@@ -175,8 +182,8 @@ class CRM_Dedupe_BAO_RuleGroup extends CRM_Dedupe_DAO_RuleGroup {
     // if there are no rules in this rule group
     // add an empty query fulfilling the pattern
     if (!$queries) {
-      $queries = array('SELECT 0 id1, 0 id2, 0 weight LIMIT 0');
       $this->noRules = TRUE;
+      return array();
     }
 
     return $queries;