CRM-17396 fix - Editing a membership price set breaks auto-renew functionality
authormonishdeb <monish.deb@webaccessglobal.com>
Thu, 15 Oct 2015 11:15:22 +0000 (16:45 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Thu, 15 Oct 2015 11:15:22 +0000 (16:45 +0530)
https://issues.civicrm.org/jira/browse/CRM-17396

CRM/Price/Form/Field.php

index 20c884c93b7508728abfead763a827d4a52b0f4b..14c81e7178008c04ac828a6c11d5f4e8ed103f80 100644 (file)
@@ -606,7 +606,6 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
     // store the submitted values in an array
     $params = $this->controller->exportValues('Field');
 
-    $params['name'] = CRM_Utils_String::titleToVar($params['label']);
     $params['is_display_amounts'] = CRM_Utils_Array::value('is_display_amounts', $params, FALSE);
     $params['is_required'] = CRM_Utils_Array::value('is_required', $params, FALSE);
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
@@ -635,6 +634,10 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
       if ($this->_fid) {
         $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $this->_fid, 'weight', 'id');
       }
+      else {
+        //CRM-17396, fetch name from label only on adding price field, not on update
+        $params['name'] = CRM_Utils_String::titleToVar($params['label']);
+      }
       $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceField', $oldWeight, $params['weight'], $fieldValues);
     }