diff --git a/CRM/Financial/BAO/FinancialType.php b/CRM/Financial/BAO/FinancialType.php index 901e7888ee45..788b38eb6f0f 100644 --- a/CRM/Financial/BAO/FinancialType.php +++ b/CRM/Financial/BAO/FinancialType.php @@ -455,9 +455,12 @@ public static function checkPermissionToEditFinancialType($financialTypeID) { public static function isACLFinancialTypeStatus() { if (!isset(\Civi::$statics[__CLASS__]['is_acl_enabled'])) { \Civi::$statics[__CLASS__]['is_acl_enabled'] = FALSE; - $contributeSettings = Civi::settings()->get('contribution_invoice_settings'); - if (CRM_Utils_Array::value('acl_financial_type', $contributeSettings)) { - \Civi::$statics[__CLASS__]['is_acl_enabled'] = TRUE; + $realSetting = \Civi::$statics[__CLASS__]['is_acl_enabled'] = Civi::settings()->get('acl_financial_type'); + if (!$realSetting) { + $contributeSettings = Civi::settings()->get('contribution_invoice_settings'); + if (CRM_Utils_Array::value('acl_financial_type', $contributeSettings)) { + \Civi::$statics[__CLASS__]['is_acl_enabled'] = TRUE; + } } } return \Civi::$statics[__CLASS__]['is_acl_enabled']; diff --git a/tests/phpunit/CRMTraits/Financial/FinancialACLTrait.php b/tests/phpunit/CRMTraits/Financial/FinancialACLTrait.php index 93ce6ffad48d..da38c5ffc6f0 100644 --- a/tests/phpunit/CRMTraits/Financial/FinancialACLTrait.php +++ b/tests/phpunit/CRMTraits/Financial/FinancialACLTrait.php @@ -38,7 +38,8 @@ trait CRMTraits_Financial_FinancialACLTrait { protected function enableFinancialACLs() { $contributeSettings = Civi::settings()->get('contribution_invoice_settings'); $this->callAPISuccess('Setting', 'create', [ - 'contribution_invoice_settings' => array_merge($contributeSettings, ['acl_financial_type' => TRUE]) + 'contribution_invoice_settings' => array_merge($contributeSettings, ['acl_financial_type' => TRUE]), + 'acl_financial_type' => TRUE, ]); unset(\Civi::$statics['CRM_Financial_BAO_FinancialType']); } @@ -49,7 +50,8 @@ protected function enableFinancialACLs() { protected function disableFinancialACLs() { $contributeSettings = Civi::settings()->get('contribution_invoice_settings'); $this->callAPISuccess('Setting', 'create', [ - 'contribution_invoice_settings' => array_merge($contributeSettings, ['acl_financial_type' => FALSE]) + 'contribution_invoice_settings' => array_merge($contributeSettings, ['acl_financial_type' => FALSE]), + 'acl_financial_type' => FALSE, ]); unset(\Civi::$statics['CRM_Financial_BAO_FinancialType']); }