CIVI-28 Added perms for price field option display
[civicrm-core.git] / CRM / Price / BAO / PriceFieldValue.php
index 441c33a617c193a0d49f9756725957cbdbbe7b30..67387a40ad2ade2bbc5a7a5365e187cb007a5475 100644 (file)
@@ -155,6 +155,7 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue {
    *
    */
   public static function getValues($fieldId, &$values, $orderBy = 'weight', $isActive = FALSE) {
+    CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes);
     $fieldValueDAO = new CRM_Price_DAO_PriceFieldValue();
     $fieldValueDAO->price_field_id = $fieldId;
     $fieldValueDAO->orderBy($orderBy, 'label');
@@ -164,6 +165,9 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue {
     $fieldValueDAO->find();
 
     while ($fieldValueDAO->fetch()) {
+      if (!in_array($fieldValueDAO->financial_type_id, array_keys($financialTypes))) {
+        continue;
+      }
       CRM_Core_DAO::storeValues($fieldValueDAO, $values[$fieldValueDAO->id]);
     }