From ba6920b37bca806f9fd606834c7530807a8401c4 Mon Sep 17 00:00:00 2001 From: eileenmcnaughton Date: Thu, 23 Jul 2015 04:22:42 +0000 Subject: [PATCH] test fix - clear static value caching --- CRM/Price/BAO/PriceField.php | 7 +++++-- CRM/Price/BAO/PriceFieldValue.php | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index b365b93cbf..f608afdc36 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -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; diff --git a/CRM/Price/BAO/PriceFieldValue.php b/CRM/Price/BAO/PriceFieldValue.php index 3ab2e89ae9..80adef24a4 100644 --- a/CRM/Price/BAO/PriceFieldValue.php +++ b/CRM/Price/BAO/PriceFieldValue.php @@ -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; } -- 2.25.1