return self::$_exportableFields;
}
+ /**
+ * @inheritDoc
+ */
+ public function addSelectWhereClause() {
+ $whereClauses = parent::addSelectWhereClause();
+ if ($whereClauses !== []) {
+ // In this case permisssions have been applied & we assume the
+ // financialaclreport is applying these
+ // https://github.com/JMAConsulting/biz.jmaconsulting.financialaclreport/blob/master/financialaclreport.php#L107
+ return $whereClauses;
+ }
+
+ if (!CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) {
+ return $whereClauses;
+ }
+ $types = CRM_Financial_BAO_FinancialType::getAllEnabledAvailableFinancialTypes();
+ if (empty($types)) {
+ $whereClauses['financial_type_id'] = 'IN (0)';
+ }
+ else {
+ $whereClauses['financial_type_id'] = [
+ 'IN (' . implode(',', array_keys($types)) . ')'
+ ];
+ }
+ return $whereClauses;
+ }
+
/**
* @param null $status
* @param null $startDate
* @param array $whereClauses
*/
public static function addACLClausesToWhereClauses(&$whereClauses) {
- $originalWhereClauses = $whereClauses;
- CRM_Utils_Hook::selectWhereClause('Contribution', $whereClauses);
- if ($whereClauses !== $originalWhereClauses) {
- // In this case permisssions have been applied & we assume the
- // financialaclreport is applying these
- // https://github.com/JMAConsulting/biz.jmaconsulting.financialaclreport/blob/master/financialaclreport.php#L107
- return;
- }
+ $contributionBAO = new CRM_Contribute_BAO_Contribution();
+ $whereClauses = array_merge($whereClauses, $contributionBAO->addSelectWhereClause());
- if (!self::isACLFinancialTypeStatus()) {
- return;
- }
- $types = self::getAllEnabledAvailableFinancialTypes();
- if (empty($types)) {
- $whereClauses['financial_type_id'] = 'IN (0)';
- }
- else {
- $whereClauses['financial_type_id'] = [
- 'IN (' . implode(',', array_keys($types)) . ')'
- ];
- }
}
/**