Unverified Commit c71645bd authored by eileen's avatar eileen 🎱 Committed by GitHub

Merge pull request #11597 from seamuslee001/CRM-20996

CRM-20996 fix db error when using the Copy function for profiles from…
parents e24cd817 e2beed76
......@@ -687,8 +687,17 @@
return _.omit(ufFieldModel.toStrictJSON(), ['id', 'uf_group_id']);
})
);
var copyLabel = ' ' + ts('(Copy)');
copy.set('title', copy.get('title').slice(0, 64 - copyLabel.length) + copyLabel);
var new_id = 1;
CRM.api3('UFGroup', 'getsingle', {
"return": ["id"],
"options": {"limit": 1, "sort": "id DESC"}
}).done(function(result) {
new_id = Number(result.id) + 1;
var copyLabel = ' ' + ts('(Copy)');
var nameSuffix = '_' + new_id;
copy.set('title', copy.get('title').slice(0, 64 - copyLabel.length) + copyLabel);
copy.set('name', copy.get('name').slice(0, 64 - nameSuffix.length) + nameSuffix);
});
return copy;
},
getModelClass: function(entity_name) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment