X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContact%2FBAO%2FQuery.php;h=e69e958d3f989b60a70f45c0447966ab32ccc36f;hb=2107ac892a73d171792b2349be354e7b93729024;hp=a487b37af4d06490b8d908cfec7bab242f142599;hpb=8489e9e09a39d22ac7e8404a0bca8719f0dfed1f;p=civicrm-core.git diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index a487b37af4..e69e958d3f 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -581,7 +581,16 @@ class CRM_Contact_BAO_Query { } if (isset($component) && !$this->_skipPermission) { // Unit test coverage in api_v3_FinancialTypeACLTest::testGetACLContribution. - CRM_Financial_BAO_FinancialType::buildPermissionedClause($this->_whereClause, $component); + $clauses = []; + if ($component === 'contribution') { + $clauses = CRM_Contribute_BAO_Contribution::getSelectWhereClause(); + } + if ($component === 'membership') { + $clauses = CRM_Member_BAO_Membership::getSelectWhereClause(); + } + if ($clauses) { + $this->_whereClause .= ' AND ' . implode(' AND ', $clauses); + } } $this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode, $apiEntity); @@ -2108,7 +2117,7 @@ class CRM_Contact_BAO_Query { } } - return implode(' AND ', $andClauses); + return $andClauses ? implode(' AND ', $andClauses) : ' 1 '; } /** @@ -2539,7 +2548,7 @@ class CRM_Contact_BAO_Query { * Search on primary location. See note below. * @param int $mode * Determines search mode based on bitwise MODE_* constants. - * @param string|NULL $apiEntity + * @param string|null $apiEntity * Determines search mode based on entity by string. * * The $primaryLocation flag only seems to be used when @@ -4869,16 +4878,15 @@ civicrm_relationship.start_date > {$today} } /** - * Include Select columns in groupBy clause. + * Include select columns in groupBy clause. * * @param array $selectClauses - * @param array $groupBy - Columns already included in GROUP By clause. + * @param array|string|null $groupBy - Columns already included in GROUP By clause. * * @return string */ public static function getGroupByFromSelectColumns($selectClauses, $groupBy = NULL) { $groupBy = (array) $groupBy; - $mysqlVersion = CRM_Core_DAO::singleValueQuery('SELECT VERSION()'); $sqlMode = CRM_Core_DAO::singleValueQuery('SELECT @@sql_mode'); //return if ONLY_FULL_GROUP_BY is not enabled.