Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue CRM-13089 #1206

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions CRM/Core/BAO/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,22 @@ static function dataToHtml() {
* @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'
);
}
$columnName = $params['column_name'];

$indexExist = FALSE;
//as during create if field is_searchable we had created index.
Expand Down Expand Up @@ -281,9 +285,6 @@ static function create(&$params) {
self::createField($customField, 'modify', $indexExist);
}
else {
if (!isset($params['column_name'])) {
$columnName .= "_{$customField->id}";
}
$customField->column_name = $columnName;
$customField->save();
// make sure all values are present in the object
Expand Down