From 38f23b8e9d95fb0f77f10180d7f2b71bdea210e6 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Thu, 20 Aug 2015 03:06:57 +0530 Subject: [PATCH] -- CRM-16526, fixed syntax error when all FT are not permissioned ---------------------------------------- * CRM-16526: ACLs for Financial Types https://issues.civicrm.org/jira/browse/CRM-16526 --- CRM/Contact/BAO/Query.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 116316ac68..19b5bfdd64 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -4750,9 +4750,12 @@ SELECT COUNT( conts.total_amount ) as total_count, CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes); if (!empty($financialTypes)) { $where .= " AND civicrm_contribution.financial_type_id IN (" . implode(',', array_keys($financialTypes)) . ") AND li.id IS NULL"; + $from .= " LEFT JOIN civicrm_line_item li + ON civicrm_contribution.id = li.contribution_id AND + li.entity_table = 'civicrm_contribution' AND li.financial_type_id NOT IN (" . implode(',', array_keys($financialTypes)) . ") "; } else { - $where .= " AND civicrm_contribution.financial_type_id IN (0) AND li.financial_type_id IN (0)"; + $where .= " AND civicrm_contribution.financial_type_id IN (0)"; } // make sure contribution is completed - CRM-4989 @@ -4761,9 +4764,6 @@ SELECT COUNT( conts.total_amount ) as total_count, $summary = array(); $summary['total'] = array(); $summary['total']['count'] = $summary['total']['amount'] = $summary['total']['avg'] = "n/a"; - $from .= " LEFT JOIN civicrm_line_item li - ON civicrm_contribution.id = li.contribution_id AND - li.entity_table = 'civicrm_contribution' AND li.financial_type_id NOT IN (" . implode(',', array_keys($financialTypes)) . ") "; $innerQuery = "SELECT civicrm_contribution.total_amount, COUNT(civicrm_contribution.total_amount) as civicrm_contribution_total_amount_count, civicrm_contribution.currency $from $completedWhere"; $query = "$select FROM ( -- 2.25.1