From e38abf14abe1a447658ae0847f582f9b459dae85 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 9 Jan 2017 13:20:08 +1300 Subject: [PATCH] CRM-19815 minor tidy ups, reduce switch clause,remove unused var --- CRM/Contribute/BAO/Query.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index f0ca0f7186..f7e4f5d06c 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -196,7 +196,17 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { return; } } - + // These are legacy names. + // @todo enotices when these are hit so we can start to elimnate them. + $fieldAliases = array( + 'financial_type' => 'financial_type_id', + 'contribution_page' => 'contribution_page_id', + 'payment_instrument' => 'payment_instrument_id', + // or payment_instrument_id? + 'contribution_payment_instrument' => 'contribution_payment_instrument_id', + 'contribution_status' => 'contribution_status_id', + ); + $name = isset($fieldAliases[$name]) ? $fieldAliases[$name] : $name; $qillName = $name; $pseudoExtraParam = array(); @@ -249,12 +259,6 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1; return; - case 'financial_type': - case 'contribution_page': - case 'payment_instrument': - case 'contribution_payment_instrument': - case 'contribution_status': - $name .= '_id'; case 'financial_type_id': // @todo we need to make this resemble a hook approach. CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes); -- 2.25.1