From 8a157729a67fb5517b2d4bd46e2e0cb36643ccdb Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 27 Oct 2014 17:11:45 +0200 Subject: [PATCH] Tasks panel: if no access to tasks then no show error --- .../modules/crm/src/views/record/panels/tasks.js | 8 +++++++- frontend/client/src/views/record/detail-side.js | 7 +++++-- .../src/views/record/panels/relationship.js | 16 ++++++++-------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/frontend/client/modules/crm/src/views/record/panels/tasks.js b/frontend/client/modules/crm/src/views/record/panels/tasks.js index 686a7c94a4..82a3c08a94 100644 --- a/frontend/client/modules/crm/src/views/record/panels/tasks.js +++ b/frontend/client/modules/crm/src/views/record/panels/tasks.js @@ -110,7 +110,13 @@ Espo.define('Crm:Views.Record.Panels.Tasks', 'Views.Record.Panels.Relationship', }, afterRender: function () { - var url = this.model.name + '/' + this.model.id + '/tasks'; + var url = this.model.name + '/' + this.model.id + '/tasks'; + + if (!this.getAcl().check('Task', 'read')) { + this.$el.find('.list-container').html(this.translate('No Access')); + this.$el.find('.button-container').remove(); + return; + }; this.getCollectionFactory().create('Task', function (collection) { this.collection = collection; diff --git a/frontend/client/src/views/record/detail-side.js b/frontend/client/src/views/record/detail-side.js index a490f3c03b..f6cc04c003 100644 --- a/frontend/client/src/views/record/detail-side.js +++ b/frontend/client/src/views/record/detail-side.js @@ -112,9 +112,12 @@ actions.forEach(function (item) { if (Espo.Utils.checkActionAccess(this.getAcl(), this.model, item)) { filtered.push(item); + if (item.action == 'createTask') { + console.log(item); + } } - }.bind(this)); - return actions; + }, this); + return filtered; }, }); }); diff --git a/frontend/client/src/views/record/panels/relationship.js b/frontend/client/src/views/record/panels/relationship.js index a9ab7eabc7..9418dd1dbc 100644 --- a/frontend/client/src/views/record/panels/relationship.js +++ b/frontend/client/src/views/record/panels/relationship.js @@ -63,19 +63,19 @@ Espo.define('Views.Record.Panels.Relationship', 'Views.Record.Panels.Bottom', fu }); } - var type = 'listSmall'; - var listLayout = null; + var type = 'listSmall'; + var listLayout = null; var layout = this.defs.layout || null; - if (layout) { - if (typeof layout == 'string') { + if (layout) { + if (typeof layout == 'string') { type = layout; - } else { + } else { type = 'listRelationship'; listLayout = layout; - } + } } - var sortBy = this.defs.sortBy || null; - var asc = this.defs.asc || null; + var sortBy = this.defs.sortBy || null; + var asc = this.defs.asc || null; this.wait(true); this.getCollectionFactory().create(this.scope, function (collection) {