test fix - clear static value caching
authoreileenmcnaughton <eileen@fuzion.co.nz>
Thu, 23 Jul 2015 04:22:42 +0000 (04:22 +0000)
committereileenmcnaughton <eileen@fuzion.co.nz>
Thu, 23 Jul 2015 04:24:47 +0000 (04:24 +0000)
CRM/Price/BAO/PriceField.php
CRM/Price/BAO/PriceFieldValue.php

index b365b93cbfbbacba09dbf785afab00b037a0de3d..f608afdc365ccda93ddcdc199ac129bfb32132fe 100644 (file)
@@ -571,15 +571,18 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField {
    * @param bool $inactiveNeeded
    *   Include inactive options.
    * @param bool $reset
-   *   Ignore stored values\.
+   *   Discard stored values.
    *
    * @return array
    *   array of options
    */
   public static function getOptions($fieldId, $inactiveNeeded = FALSE, $reset = FALSE) {
     static $options = array();
+    if ($reset) {
+      $options = array();
+    }
 
-    if ($reset || empty($options[$fieldId])) {
+    if (empty($options[$fieldId])) {
       $values = array();
       CRM_Price_BAO_PriceFieldValue::getValues($fieldId, $values, 'weight', !$inactiveNeeded);
       $options[$fieldId] = $values;
index 3ab2e89ae926db7e7f8aea888a26392e3a250861..80adef24a483686dcb4e6be5fdf044f7708b89fa 100644 (file)
@@ -64,6 +64,8 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue {
     }
 
     $fieldValueBAO->save();
+    // Reset the cached values in this function.
+    CRM_Price_BAO_PriceField::getOptions($params['price_field_id'], FALSE, TRUE);
     return $fieldValueBAO;
   }