From: mmikitka Date: Fri, 19 Jul 2013 23:46:17 +0000 (-0400) Subject: Fix for issue CRM-13089 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f3f0709da96767d9fa440b5370a17ed39e835d4b;p=civicrm-core.git Fix for issue CRM-13089 ---------------------------------------- * CRM-13089: CRM_Core_BAO_CustomField::create overrides user-defined name parameter values http://issues.civicrm.org/jira/browse/CRM-13089 --- diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index c2197f9d5b..77e306f909 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -130,14 +130,17 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { * @static */ static function create(&$params) { - if (!isset($params['id']) && !isset($params['column_name'])) { - // if add mode & column_name not present, calculate it. - $columnName = strtolower(CRM_Utils_String::munge($params['label'], '_', 32)); - - $params['name'] = CRM_Utils_String::munge($params['label'], '_', 64); + if (!isset($params['id'])) { + if (!isset($params['column_name'])) { + // if add mode & column_name not present, calculate it. + $params['column_name'] = strtolower(CRM_Utils_String::munge($params['label'], '_', 32)); + } + if (!isset($params['name'])) { + $params['name'] = CRM_Utils_String::munge($params['label'], '_', 64); + } } - elseif (isset($params['id'])) { - $columnName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', + else { + $params['column_name'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $params['id'], 'column_name' );