From 883e476397a87af580d7aff9f5eb67dc02edff73 Mon Sep 17 00:00:00 2001 From: monishdeb Date: Wed, 11 Dec 2013 11:30:56 +0530 Subject: [PATCH] CRM-13710 fix - Required prices sets still required even when not active http://issues.civicrm.org/jira/browse/CRM-13710 --- CRM/Price/BAO/PriceSet.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index 1c4ed9675a..df0ee14558 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -802,6 +802,7 @@ WHERE id = %1"; $priceSet = self::getSetDetail($priceSetId, TRUE, $validFieldsOnly); $form->_priceSet = CRM_Utils_Array::value($priceSetId, $priceSet); + $validPriceFieldIds = array_keys($form->_priceSet['fields']); $form->_quickConfig = $quickConfig = 0; if (CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config')) { $quickConfig = 1; @@ -831,7 +832,7 @@ WHERE id = %1"; // call the hook. CRM_Utils_Hook::buildAmount($component, $form, $feeBlock); - foreach ($feeBlock as $field) { + foreach ($feeBlock as $id => $field) { if (CRM_Utils_Array::value('visibility', $field) == 'public' || !$validFieldsOnly ) { @@ -842,7 +843,7 @@ WHERE id = %1"; $form->assign('ispricelifetime', TRUE); } } - if (!is_array($options)) { + if (!is_array($options) || !in_array($id, $validPriceFieldIds)) { continue; } CRM_Price_BAO_PriceField::addQuickFormElement($form, -- 2.25.1