From ace6a8650aede3a09f5d1384955d34d2de39dd89 Mon Sep 17 00:00:00 2001 From: Edsel Date: Fri, 17 Apr 2015 17:49:19 +0530 Subject: [PATCH] CIVI-28 More fixes for reports and memberships --- CRM/Financial/BAO/FinancialType.php | 4 ++++ CRM/Report/Form/Contribute/Bookkeeping.php | 2 +- CRM/Report/Form/Contribute/SoftCredit.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CRM/Financial/BAO/FinancialType.php b/CRM/Financial/BAO/FinancialType.php index 4405bbdd31..9135d4fcef 100644 --- a/CRM/Financial/BAO/FinancialType.php +++ b/CRM/Financial/BAO/FinancialType.php @@ -247,6 +247,10 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType { if ($component == 'membership') { self::getAvailableMembershipTypes($types, 'view'); $column = "membership_type_id"; + if (empty($types)) { + $whereClauses .= " AND civicrm_{$component}.{$column} IN (0)"; + return; + } } $whereClauses .= " AND civicrm_{$component}.{$column} IN (". implode(',' , array_keys($types)) .")"; } diff --git a/CRM/Report/Form/Contribute/Bookkeeping.php b/CRM/Report/Form/Contribute/Bookkeeping.php index 9eac3a9c29..295142b443 100644 --- a/CRM/Report/Form/Contribute/Bookkeeping.php +++ b/CRM/Report/Form/Contribute/Bookkeeping.php @@ -219,7 +219,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form { 'financial_type_id' => array( 'title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Contribute_PseudoConstant::financialType(), + 'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(), ), ), 'order_bys' => array( diff --git a/CRM/Report/Form/Contribute/SoftCredit.php b/CRM/Report/Form/Contribute/SoftCredit.php index db472f26f5..d5474f4703 100644 --- a/CRM/Report/Form/Contribute/SoftCredit.php +++ b/CRM/Report/Form/Contribute/SoftCredit.php @@ -219,7 +219,7 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form { 'name' => 'id', 'title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Contribute_PseudoConstant::financialType(), + 'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(), ), ), 'grouping' => 'softcredit-fields', -- 2.25.1