CRM-19741: Price set and price set value label fields are inconsistant to users
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 3 Feb 2017 12:01:22 +0000 (17:31 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 3 Feb 2017 12:11:26 +0000 (17:41 +0530)
CRM/Price/BAO/PriceField.php

index 6f3284c63be79936f48fdfdf67b1f610da2fd800..e7b64f96ddf696d0294a8dda5beec340d517b23c 100644 (file)
@@ -89,6 +89,9 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField {
       return $priceField;
     }
 
+    if (!empty($params['id']) && empty($priceField->html_type)) {
+      $priceField->html_type = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['id'], 'html_type');
+    }
     $optionsIds = array();
     $maxIndex = CRM_Price_Form_Field::NUM_OPTION;
 
@@ -102,6 +105,12 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField {
       if ($fieldValue->find(TRUE)) {
         $optionsIds['id'] = $fieldValue->id;
       }
+
+      //Update price_field_value label when edited inline.
+      if (!empty($params['id']) && $priceField->label != $fieldValue->label) {
+        $fieldValue->label = $priceField->label;
+        $fieldValue->save();
+      }
     }
     $defaultArray = array();
     //html type would be empty in update scenario not sure what would happen ...