From f3f0709da96767d9fa440b5370a17ed39e835d4b Mon Sep 17 00:00:00 2001 From: mmikitka Date: Fri, 19 Jul 2013 19:46:17 -0400 Subject: [PATCH] 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 --- CRM/Core/BAO/CustomField.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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' ); -- 2.25.1