CRM-17351: more fixes for unsetting option
authoryashodha <yashodha.chaku@webaccessglobal.com>
Thu, 8 Oct 2015 11:06:30 +0000 (16:36 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Thu, 8 Oct 2015 11:06:30 +0000 (16:36 +0530)
----------------------------------------
* CRM-17351: Unable to mark price set field as inactive
  https://issues.civicrm.org/jira/browse/CRM-17351

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

index 6daeb86f2530b7e48fc4aa2503de749da6d96337..55958245cb1af6597b0ac12eb2c2b4dd8dae6f96 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'])) {
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;