Fix malformed query when user with no access to any financial acls accesses civimembe...
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 15 Apr 2022 22:26:28 +0000 (10:26 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 19 Apr 2022 19:41:40 +0000 (07:41 +1200)
ext/financialacls/financialacls.php

index 4870bf4a9702a6aaee1be8c21910d9a40f07a749..45366d57ba2f926f1707a552dd7e9cd75c4840e4 100644 (file)
@@ -224,12 +224,9 @@ function _financialacls_civicrm_get_accessible_financial_types(): array {
  * @throws \API_Exception
  */
 function _financialacls_civicrm_get_membership_type_clause(): string {
-  if (!CRM_Core_Component::isEnabled('CiviMember')) {
-    return 1;
-  }
   $financialTypes = _financialacls_civicrm_get_accessible_financial_types();
-  if ($financialTypes === [0]) {
-    return 0;
+  if ($financialTypes === [0] || !CRM_Core_Component::isEnabled('CiviMember')) {
+    return '= 0';
   }
   $membershipTypes = (array) MembershipType::get(FALSE)
     ->addWhere('financial_type_id', 'IN', $financialTypes)->execute()->indexBy('id');