From 27ed95374b559f6459e71a5909d0b037b20bd991 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Fri, 3 Feb 2017 17:31:22 +0530 Subject: [PATCH 1/2] CRM-19741: Price set and price set value label fields are inconsistant to users --- CRM/Price/BAO/PriceField.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index 6f3284c63be7..e7b64f96ddf6 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -89,6 +89,9 @@ public static function create(&$params) { 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 @@ public static function create(&$params) { 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 ... From ff295966bfc9519a28baa5ac7933140bed068350 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Mon, 6 Feb 2017 10:36:08 +0530 Subject: [PATCH 2/2] fix test --- CRM/Price/BAO/PriceField.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index e7b64f96ddf6..969402bd73e3 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -104,12 +104,12 @@ public static function create(&$params) { // update previous field values( if any ) 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(); + //Update price_field_value label when edited inline. + if (!empty($params['id']) && $priceField->label != $fieldValue->label) { + $fieldValue->label = $priceField->label; + $fieldValue->save(); + } } } $defaultArray = array();