From b962d1572a6fa11196ac904bb88b9c0f60b695e5 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 4 Dec 2019 12:58:56 +0200 Subject: [PATCH 1/5] fix users positions --- .../src/views/fields/link-multiple-with-role.js | 3 +-- client/src/views/user/fields/teams.js | 15 +++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/client/src/views/fields/link-multiple-with-role.js b/client/src/views/fields/link-multiple-with-role.js index cc5ac0ca18..3c25697d48 100644 --- a/client/src/views/fields/link-multiple-with-role.js +++ b/client/src/views/fields/link-multiple-with-role.js @@ -58,9 +58,8 @@ define('views/fields/link-multiple-with-role', 'views/fields/link-multiple', fun this.roleFieldScope = this.model.name; } - if (this.roleType == 'enum') { + if (this.roleType == 'enum' && !this.forceRoles) { this.roleList = this.getMetadata().get('entityDefs.' + this.roleFieldScope + '.fields.' + this.roleField + '.options'); - if (!this.roleList) { this.roleList = []; this.skipRoles = true; diff --git a/client/src/views/user/fields/teams.js b/client/src/views/user/fields/teams.js index 9e4c11ac57..d2a5d31981 100644 --- a/client/src/views/user/fields/teams.js +++ b/client/src/views/user/fields/teams.js @@ -26,10 +26,12 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/user/fields/teams', 'views/fields/link-multiple-with-role', function (Dep) { +define('views/user/fields/teams', 'views/fields/link-multiple-with-role', function (Dep) { return Dep.extend({ + forceRoles: true, + setup: function () { Dep.prototype.setup.call(this); @@ -43,7 +45,6 @@ Espo.define('views/user/fields/teams', 'views/fields/link-multiple-with-role', f } }, this); - this.listenTo(this.model, 'change:teamsIds', function () { var toLoad = false; this.ids.forEach(function (id) { @@ -85,7 +86,6 @@ Espo.define('views/user/fields/teams', 'views/fields/link-multiple-with-role', f teams.fetch(); }, this); - }, getDetailLinkHtml: function (id, name) { @@ -94,6 +94,7 @@ Espo.define('views/user/fields/teams', 'views/fields/link-multiple-with-role', f var role = (this.columns[id] || {})[this.columnName] || ''; var roleHtml = ''; if (role != '') { + role = this.getHelper().escapeString(role); roleHtml = ' » ' + role + ''; } var lineHtml = '
' + '' + name + ' ' + roleHtml + '
'; @@ -101,15 +102,11 @@ Espo.define('views/user/fields/teams', 'views/fields/link-multiple-with-role', f }, getJQSelect: function (id, roleValue) { - - var roleList = Espo.Utils.clone((this.roleListMap[id] || [])); if (!roleList.length) { return; }; - - if (roleList.length || roleValue) { $role = $('