Skip to content

Commit

Permalink
CRM-13089 - Restore numeric suffix for new (default) column names
Browse files Browse the repository at this point in the history
----------------------------------------
* CRM-13089: CRM_Core_BAO_CustomField::create overrides user-defined name parameter values
  http://issues.civicrm.org/jira/browse/CRM-13089
  • Loading branch information
totten committed Aug 9, 2013
1 parent 4d32d50 commit 79f68e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CRM/Core/BAO/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ static function dataToHtml() {
* @static
*/
static function create(&$params) {
$origParams = array_merge(array(), $params);

if (!isset($params['id'])) {
if (!isset($params['column_name'])) {
// if add mode & column_name not present, calculate it.
Expand Down Expand Up @@ -285,6 +287,10 @@ static function create(&$params) {
self::createField($customField, 'modify', $indexExist);
}
else {
if (!isset($origParams['column_name'])) {
$columnName .= "_{$customField->id}";
$params['column_name'] = $columnName;
}
$customField->column_name = $columnName;
$customField->save();
// make sure all values are present in the object
Expand Down

0 comments on commit 79f68e4

Please sign in to comment.