From a0c2c5833efb82c23aaf719dbdd24e20b9c4d53c Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 15 Jun 2016 15:51:47 +0530 Subject: [PATCH] CRM-16189, added function to retrieve values from settings ---------------------------------------- * CRM-16189: Improve support for Accrual Method bookkeeping https://issues.civicrm.org/jira/browse/CRM-16189 --- CRM/Contribute/PseudoConstant.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CRM/Contribute/PseudoConstant.php b/CRM/Contribute/PseudoConstant.php index f5f79750b5..350181e4a9 100644 --- a/CRM/Contribute/PseudoConstant.php +++ b/CRM/Contribute/PseudoConstant.php @@ -101,6 +101,12 @@ class CRM_Contribute_PseudoConstant extends CRM_Core_PseudoConstant { */ private static $batch; + /** + * Get values of CiviContribute Settings + * @var array + */ + private static $contributeSettings; + /** * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. * @@ -440,4 +446,24 @@ class CRM_Contribute_PseudoConstant extends CRM_Core_PseudoConstant { return self::$batch; } + /** + * Get values of CiviContribute Settings + * and check if its enabled or not + * + * + * @param string $name + * @return string + * + */ + public static function checkContributeSettings($name = NULL) { + if (empty(self::$contributeSettings)) { + self::$contributeSettings = Civi::settings()->get('contribution_invoice_settings'); + } + + if ($name) { + return CRM_Utils_Array::value($name, self::$contributeSettings); + } + return self::$contributeSettings; + } + } -- 2.25.1