Merge pull request #6912 from yashodha/CRM-17351
authorKurund Jalmi <kurund@civicrm.org>
Sun, 11 Oct 2015 14:04:10 +0000 (15:04 +0100)
committerKurund Jalmi <kurund@civicrm.org>
Sun, 11 Oct 2015 14:04:10 +0000 (15:04 +0100)
CRM-17351: Unable to mark price set field as inactive

CRM/Price/Form/Field.php
CRM/Price/Form/Option.php

index 1e2aa8f4a6fefdf782592a03a173b87cc522ac27..06552bc2109ef62c53bed49950fbe43bc6ccd770 100644 (file)
@@ -108,12 +108,14 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
 
       // if text, retrieve price
       if ($defaults['html_type'] == 'Text') {
+        $isActive = $defaults['is_active'];
         $valueParams = array('price_field_id' => $this->_fid);
 
         CRM_Price_BAO_PriceFieldValue::retrieve($valueParams, $defaults);
 
         // fix the display of the monetary value, CRM-4038
         $defaults['price'] = CRM_Utils_Money::format($defaults['amount'], NULL, '%a');
+        $defaults['is_active'] = $isActive;
       }
 
       if (!empty($defaults['active_on'])) {
@@ -647,7 +649,6 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
       //$params['option_description']  = array( 1 => $params['description'] );
       $params['option_weight'] = array(1 => $params['weight']);
       $params['option_financial_type_id'] = array(1 => $params['financial_type_id']);
-      $params['is_active'] = array(1 => 1);
     }
 
     if ($this->_fid) {
index 050abd9694f156bf936428e7ddb6edcd8a17cf80..434440c4415195fd7b675ab78a81c97b63387f38 100644 (file)
@@ -311,6 +311,7 @@ class CRM_Price_Form_Option extends CRM_Core_Form {
       $params['amount'] = CRM_Utils_Rule::cleanMoney(trim($params['amount']));
       $params['price_field_id'] = $this->_fid;
       $params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE);
+      $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
       $ids = array();
       if ($this->_oid) {
         $ids['id'] = $this->_oid;