Fixed typo and added check for whether is empty
authorJaap Jansma <jaap.jansma@civicoop.org>
Mon, 12 Apr 2021 07:37:57 +0000 (09:37 +0200)
committerJaap Jansma <jaap.jansma@civicoop.org>
Mon, 12 Apr 2021 07:37:57 +0000 (09:37 +0200)
CRM/Contact/BAO/Query.php
tests/phpunit/CRM/Case/BAO/QueryTest.php

index 76686c7848d3ca4b5c3945731e32b86437ba3cd8..1e268336ba9f8b07a8c25eb118cccada2c994e54 100644 (file)
@@ -5837,6 +5837,9 @@ AND   displayRelType.is_active = 1
       else {
         $from .= $qcache['from'];
       }
+      if (!strlen($where)) {
+        $where = " WHERE 1 ";
+      }
       $where .= $qcache['where'];
       if (!empty($this->_tables['civicrm_case'])) {
         // Change the join on CiviCRM case so that it joins on the right contac from the relationship.
index 3c34c76eecaa831a63b29d2885e7d31633ad8648..87fc0e344d6f5cba996c27eeaf6c5ee6a48863f5 100644 (file)
@@ -145,7 +145,7 @@ class CRM_Case_BAO_QueryTest extends CiviCaseTestCase {
     $clientContactID = $this->individualCreate(['first_name' => 'John', 'last_name' => 'Smith']);
     $benefitSpecialist1 = $this->individualCreate(['Individual', 'first_name' => 'Alexa', 'last_name' => 'Clarke']);
     $benefitSpecialist2 = $this->individualCreate(['Individual', 'first_name' => 'Sandra', 'last_name' => 'Johnson']);
-    $housingSupportCase = $this->createCase($clientContactID, NULL, ['case_type_id' => 'housing_support', 'case_type_id' => 1]);
+    $housingSupportCase = $this->createCase($clientContactID, NULL, ['case_type' => 'housing_support', 'case_type_id' => 1]);
     $adultDayCareReferralCase = $this->createCase($clientContactID, NULL, ['case_type' => 'adult_day_care_referral', 'case_type_id' => 2]);
     civicrm_api3('Relationship', 'create', ['contact_id_a' => $clientContactID, 'contact_id_b' => $benefitSpecialist1, 'relationship_type_id' => $benefitRelationshipTypeId, 'case_id' => $housingSupportCase->id]);
     civicrm_api3('Relationship', 'create', ['contact_id_a' => $clientContactID, 'contact_id_b' => $benefitSpecialist2, 'relationship_type_id' => $benefitRelationshipTypeId, 'case_id' => $adultDayCareReferralCase->id]);