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

Allows multiple Free Text fields to be added to form layout #25271

Merged
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
9 changes: 6 additions & 3 deletions js/model/crm.uf.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,15 @@
*
*/
markDuplicates: function() {
var ufFieldModelsByKey = this.groupBy(function(ufFieldModel) {
const ufFieldModelsByKey = this.groupBy(function(ufFieldModel) {
return ufFieldModel.getSignature();
});
this.each(function(ufFieldModel){
var is_duplicate = ufFieldModelsByKey[ufFieldModel.getSignature()].length > 1;
if (is_duplicate != ufFieldModel.get('is_duplicate')) {
const length = ufFieldModelsByKey[ufFieldModel.getSignature()].length > 1;
// Allow multiple free html fields, but note this would only work on an English install, and only if the field label hasn't been changed.
const label = ufFieldModelsByKey[ufFieldModel.getSignature()][0].attributes.label !== 'Free HTML';
demeritcowboy marked this conversation as resolved.
Show resolved Hide resolved
const is_duplicate = length && label;
if (is_duplicate !== ufFieldModel.get('is_duplicate')) {
ufFieldModel.set('is_duplicate', is_duplicate);
}
});
Expand Down