From d51d109df43bd512db15abd194923cb2796bf859 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 7 Aug 2017 11:08:19 +1000 Subject: [PATCH] Attempt to get rid of pasing by reference and change variable as needed --- CRM/Contribute/BAO/Contribution.php | 6 +++--- CRM/Financial/BAO/FinancialType.php | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 6f05ba884a..89cd0ab8ec 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -604,8 +604,8 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { if ($retrieveRequired == 1) { $contribution->find(TRUE); } - $contributionType = CRM_Contribute_PseudoConstant::financialType($contribution->financial_type_id); - $title = CRM_Contact_BAO_Contact::displayName($contribution->contact_id) . ' - (' . CRM_Utils_Money::format($contribution->total_amount, $contribution->currency) . ' ' . ' - ' . $contributionType . ')'; + $financialType = CRM_Contribute_PseudoConstant::financialType($contribution->financial_type_id); + $title = CRM_Contact_BAO_Contact::displayName($contribution->contact_id) . ' - (' . CRM_Utils_Money::format($contribution->total_amount, $contribution->currency) . ' ' . ' - ' . $financialType . ')'; $recentOther = array(); if (CRM_Core_Permission::checkActionPermission('CiviContribute', CRM_Core_Action::UPDATE)) { @@ -2132,7 +2132,7 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ if (!$contactId) { return 0; } - CRM_Financial_BAO_FinancialType::getAllAvailableFinancialTypes($financialTypes); + $financialTypes = CRM_Financial_BAO_FinancialType::getAllAvailableFinancialTypes(); $additionalWhere = " AND contribution.financial_type_id IN (0)"; $liWhere = " AND i.financial_type_id IN (0)"; if (!empty($financialTypes)) { diff --git a/CRM/Financial/BAO/FinancialType.php b/CRM/Financial/BAO/FinancialType.php index 621837a163..03edd79a6b 100644 --- a/CRM/Financial/BAO/FinancialType.php +++ b/CRM/Financial/BAO/FinancialType.php @@ -249,7 +249,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType { * CRM-21026 * Wrapper aroung getAvaliableFinancialTypes to get all including disabled FinancialTypes * @param array $financialTypes - * (reference ) an array of financial types + * an array of financial types * @param int|string $action * the type of action, can be add, view, edit, delete * @param bool $resetCache @@ -257,18 +257,18 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType { * * @return array */ - public static function getAllAvailableFinancialTypes(&$financialTypes = NULL, $action = CRM_Core_Action::VIEW, $resetCache = FALSE) { + public static function getAllAvailableFinancialTypes($financialTypes = NULL, $action = CRM_Core_Action::VIEW, $resetCache = FALSE) { // Flush pseudoconstant cache CRM_Contribute_PseudoConstant::flush('financialType'); - self::getAvailableFinancialTypes($financialTypes, $action, $resetCache, TRUE); - return $financialTypes; + $fTypes = self::getAvailableFinancialTypes($financialTypes, $action, $resetCache, TRUE); + return $fTypes; } /** * CRM-21026 * Wrapper aroung getAvaliableFinancialTypes to get all FinancialTypes Excluding Disabled ones. * @param array $financialTypes - * (reference ) an array of financial types + * an array of financial types * @param int|string $action * the type of action, can be add, view, edit, delete * @param bool $resetCache @@ -276,9 +276,9 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType { * * @return array */ - public static function getAllEnabledAvailableFinancialTypes(&$financialTypes = NULL, $action = CRM_Core_Action::VIEW, $resetCache = FALSE) { - self::getAvailableFinancialTypes($financialTypes, $action, $resetCache); - return $financialTypes; + public static function getAllEnabledAvailableFinancialTypes($financialTypes = NULL, $action = CRM_Core_Action::VIEW, $resetCache = FALSE) { + $fTypes = self::getAvailableFinancialTypes($financialTypes, $action, $resetCache); + return $fTypes; } /** @@ -371,7 +371,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType { return FALSE; } if (is_array($whereClauses)) { - self::getAvailableFinancialTypes($types); + $types = self::getAllEnabledAvailableFinancialTypes(); if (empty($types)) { $whereClauses[] = ' ' . $alias . '.financial_type_id IN (0)'; } -- 2.25.1