From 93548514d7ddb50f3be4b77c5d61b31f03cd2fda Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 2 Jan 2017 13:04:09 +1300 Subject: [PATCH] CRM-19815 preliminary tidy-up adjust confusing switch logic to 'opt-in' --- CRM/Contribute/BAO/Query.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index cde1107600..f0ca0f7186 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -275,19 +275,13 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { case (strpos($name, '_date') !== FALSE && $name != 'contribution_fulfilled_date'): case 'contribution_campaign_id': - // @todo including names using a switch statement & then using an 'if' to filter them out is ... odd! - if ((strpos($name, '_amount') !== FALSE) || (strpos($name, '_date') !== FALSE) || in_array($name, - array( - 'contribution_id', - 'contribution_currency', - 'contribution_source', - 'contribution_trxn_id', - 'contribution_check_number', - 'contribution_payment_instrument_id', - 'contribution_contact_id', - 'contribution_campaign_id', - ) - ) + $fieldNamesNotToStripContributionFrom = array( + 'contribution_currency_type', + 'contribution_status_id', + 'contribution_page_id', + ); + // @todo these are mostly legacy params. Find a better way to deal with them. + if (!in_array($name, $fieldNamesNotToStripContributionFrom) ) { if (!isset($fields[$name])) { $qillName = str_replace('contribution_', '', $qillName); -- 2.25.1