From: monishdeb Date: Wed, 11 Dec 2013 06:00:56 +0000 (+0530) Subject: CRM-13710 fix - Required prices sets still required even when not active X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=883e476397a87af580d7aff9f5eb67dc02edff73;p=civicrm-core.git CRM-13710 fix - Required prices sets still required even when not active http://issues.civicrm.org/jira/browse/CRM-13710 --- 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,