From f71679cf4711e7e3be8a46b3e197555eae8491ab Mon Sep 17 00:00:00 2001 From: Edsel Date: Thu, 30 Apr 2015 15:39:31 +0530 Subject: [PATCH] CIVI-28 Added filter for bookeeping report --- CRM/Financial/BAO/FinancialType.php | 7 ++++++- CRM/Report/Form/Contribute/Bookkeeping.php | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CRM/Financial/BAO/FinancialType.php b/CRM/Financial/BAO/FinancialType.php index 322b789568..1220200c26 100644 --- a/CRM/Financial/BAO/FinancialType.php +++ b/CRM/Financial/BAO/FinancialType.php @@ -237,7 +237,12 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType { public static function buildPermissionedClause(&$whereClauses, $component = NULL, $alias = NULL) { if (is_array($whereClauses)) { self::getAvailableFinancialTypes($types); - $whereClauses[] = ' '.$alias.'.financial_type_id IN (' . implode(',' , array_keys($types)) .')'; + if (empty($types)) { + $whereClauses[] = ' '.$alias.'.financial_type_id IN (0)'; + } + else { + $whereClauses[] = ' '.$alias.'.financial_type_id IN (' . implode(',' , array_keys($types)) .')'; + } } else { if ($component == 'contribution') { diff --git a/CRM/Report/Form/Contribute/Bookkeeping.php b/CRM/Report/Form/Contribute/Bookkeeping.php index 295142b443..40956d98af 100644 --- a/CRM/Report/Form/Contribute/Bookkeeping.php +++ b/CRM/Report/Form/Contribute/Bookkeeping.php @@ -475,6 +475,9 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form { else { $this->_where = 'WHERE ' . implode(' AND ', $clauses); } + CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes); + $this->_where .= " AND {$this->_aliases['civicrm_contribution']}.financial_type_id IN (" . implode(',' , array_keys($financialTypes)) . ")"; + $this->_where .= " AND {$this->_aliases['civicrm_line_item']}.financial_type_id IN (" . implode(',' , array_keys($financialTypes)) . ")"; } public function postProcess() { -- 2.25.1