CRM-17644 fix caching on tax rates to still cache if none set
authoreileen <emcnaughton@wikimedia.org>
Tue, 1 Dec 2015 17:38:37 +0000 (06:38 +1300)
committereileen <emcnaughton@wikimedia.org>
Wed, 2 Dec 2015 03:10:47 +0000 (16:10 +1300)
Change-Id: I9cbfc19a50e5848fc7ec0a6448929558b3f46fe4

CRM/Core/PseudoConstant.php

index 5135da2aade5ed6b04efd365d5fc0b5d3d407fc6..1335766dc75aadd9e1261bb42b4f66b9f2ce6e7b 100644 (file)
@@ -179,12 +179,6 @@ class CRM_Core_PseudoConstant {
    */
   private static $accountOptionValues;
 
-  /**
-   * Tax Rates
-   * @var array
-   */
-  private static $taxRates;
-
   /**
    * Low-level option getter, rarely accessed directly.
    * NOTE: Rather than calling this function directly use CRM_*_BAO_*::buildOptions()
@@ -1848,8 +1842,8 @@ WHERE  id = %1
    *   array list of tax rates with the financial type
    */
   public static function getTaxRates() {
-    if (!self::$taxRates) {
-      self::$taxRates = array();
+    if (!isset(Civi::$statics[__CLASS__]['taxRates'])) {
+      Civi::$statics[__CLASS__]['taxRates'] = array();
       $sql = "
         SELECT fa.tax_rate, efa.entity_id
         FROM civicrm_entity_financial_account efa
@@ -1862,11 +1856,11 @@ WHERE  id = %1
         AND fa.is_active = 1";
       $dao = CRM_Core_DAO::executeQuery($sql);
       while ($dao->fetch()) {
-        self::$taxRates[$dao->entity_id] = $dao->tax_rate;
+        Civi::$statics[__CLASS__]['taxRates'][$dao->entity_id] = $dao->tax_rate;
       }
     }
 
-    return self::$taxRates;
+    return Civi::$statics[__CLASS__]['taxRates'];
   }
 
 }