EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
include shared dashlet parameter
Yuri Kuznetsov9a407eef6dd3
diff --git a/application/Espo/Modules/Crm/Resources/metadata/dashlets/Cases.json b/application/Espo/Modules/Crm/Resources/metadata/dashlets/Cases.jsonindex 6b36f07393..f559a3f62e 100644--- a/application/Espo/Modules/Crm/Resources/metadata/dashlets/Cases.json+++ b/application/Espo/Modules/Crm/Resources/metadata/dashlets/Cases.json@@ -1,8 +1,9 @@{- "view":"views/dashlets/abstract/record-list",+ "view": "views/dashlets/abstract/record-list","aclScope": "Case","entityType": "Case","options": {+ "view": "views/dashlets/options/record-list","fields": {"title": {"type": "varchar",@@ -20,6 +21,9 @@"expandedLayout": {"type": "base","view": "views/dashlets/fields/records/expanded-layout"+ },+ "includeShared": {+ "type": "bool"}},"defaults": {@@ -27,6 +31,7 @@"order": "desc","displayRecords": 5,"populateAssignedUser": true,+ "includeShared": false,"expandedLayout": {"rows": [[@@ -65,11 +70,12 @@{"rows": [[- {"name": "title"}+ {"name": "title"},+ {"name": "autorefreshInterval"}],[{"name": "displayRecords"},- {"name": "autorefreshInterval"}+ {"name": "includeShared"}],[{"name": "expandedLayout"},diff --git a/application/Espo/Modules/Crm/Resources/metadata/dashlets/Leads.json b/application/Espo/Modules/Crm/Resources/metadata/dashlets/Leads.jsonindex 2f2b790a81..9485929678 100644--- a/application/Espo/Modules/Crm/Resources/metadata/dashlets/Leads.json+++ b/application/Espo/Modules/Crm/Resources/metadata/dashlets/Leads.json@@ -1,8 +1,9 @@{- "view":"views/dashlets/abstract/record-list",+ "view": "views/dashlets/abstract/record-list","aclScope": "Lead","entityType": "Lead","options": {+ "view": "views/dashlets/options/record-list","fields": {"title": {"type": "varchar",@@ -20,6 +21,9 @@"expandedLayout": {"type": "base","view": "views/dashlets/fields/records/expanded-layout"+ },+ "includeShared": {+ "type": "bool"}},"defaults": {@@ -27,6 +31,7 @@"order": "desc","displayRecords": 5,"populateAssignedUser": true,+ "includeShared": false,"expandedLayout": {"rows": [[@@ -59,11 +64,12 @@{"rows": [[- {"name": "title"}+ {"name": "title"},+ {"name": "autorefreshInterval"}],[{"name": "displayRecords"},- {"name": "autorefreshInterval"}+ {"name": "includeShared"}],[{"name": "expandedLayout"},diff --git a/application/Espo/Modules/Crm/Resources/metadata/dashlets/Opportunities.json b/application/Espo/Modules/Crm/Resources/metadata/dashlets/Opportunities.jsonindex 915843340d..5459cbf37c 100644--- a/application/Espo/Modules/Crm/Resources/metadata/dashlets/Opportunities.json+++ b/application/Espo/Modules/Crm/Resources/metadata/dashlets/Opportunities.json@@ -1,8 +1,9 @@{- "view":"views/dashlets/abstract/record-list",+ "view": "views/dashlets/abstract/record-list","aclScope": "Opportunity","entityType": "Opportunity","options": {+ "view": "views/dashlets/options/record-list","fields": {"title": {"type": "varchar",@@ -20,6 +21,9 @@"expandedLayout": {"type": "base","view": "views/dashlets/fields/records/expanded-layout"+ },+ "includeShared": {+ "type": "bool"}},"defaults": {@@ -27,6 +31,7 @@"order": "asc","displayRecords": 5,"populateAssignedUser": true,+ "includeShared": false,"expandedLayout": {"rows": [[@@ -56,11 +61,12 @@{"rows": [[- {"name": "title"}+ {"name": "title"},+ {"name": "autorefreshInterval"}],[{"name": "displayRecords"},- {"name": "autorefreshInterval"}+ {"name": "includeShared"}],[{"name": "expandedLayout"},diff --git a/application/Espo/Modules/Crm/Resources/metadata/dashlets/Tasks.json b/application/Espo/Modules/Crm/Resources/metadata/dashlets/Tasks.jsonindex 90882b6377..d837fb83bc 100644--- a/application/Espo/Modules/Crm/Resources/metadata/dashlets/Tasks.json+++ b/application/Espo/Modules/Crm/Resources/metadata/dashlets/Tasks.json@@ -1,8 +1,9 @@{- "view":"crm:views/dashlets/tasks",+ "view": "crm:views/dashlets/tasks","aclScope": "Task","entityType": "Task","options": {+ "view": "views/dashlets/options/record-list","fields": {"title": {"type": "varchar",@@ -20,12 +21,16 @@"expandedLayout": {"type": "base","view": "views/dashlets/fields/records/expanded-layout"+ },+ "includeShared": {+ "type": "bool"}},"defaults": {"orderBy": "dateUpcoming","order": "asc","displayRecords": 5,+ "includeShared": false,"expandedLayout": {"rows": [[@@ -58,14 +63,16 @@{"rows": [[- {"name": "title"}+ {"name": "title"},+ {"name": "autorefreshInterval"}],[{"name": "displayRecords"},- {"name": "autorefreshInterval"}+ {"name": "includeShared"}],[- {"name": "expandedLayout", "fullWidth": true}+ {"name": "expandedLayout"},+ false]]}diff --git a/client/src/views/dashlets/abstract/record-list.js b/client/src/views/dashlets/abstract/record-list.jsindex 87215f7b87..f03fa35738 100644--- a/client/src/views/dashlets/abstract/record-list.js+++ b/client/src/views/dashlets/abstract/record-list.js@@ -68,13 +68,21 @@ class RecordListDashletView extends BaseDashletView {rowActionsView = 'views/record/row-actions/view-and-edit'+ /**+ * @protected+ * @type {boolean}+ */+ hasCollaborators+init() {this.name = this.options.name || this.name;- this.scope = this.getMetadata().get(['dashlets', this.name, 'entityType']) || this.scope;+ this.scope = this.getMetadata().get(`dashlets.${this.name}.entityType`) || this.scope;this.additionalRowActionList = this.getMetadata().get(`dashlets.${this.name}.rowActionList`) ||this.additionalRowActionList;+ this.hasCollaborators = !!this.getMetadata().get(`scopes.${this.scope}.collaborators`);+super.init();}@@ -86,7 +94,22 @@ class RecordListDashletView extends BaseDashletView {* @return {module:search-manager~data}*/getSearchData() {- return this.getOption('searchData');+ /** @type {module:search-manager~data} */+ const data = Espo.Utils.cloneDeep(this.getOption('searchData'));++ if (!this.hasCollaborators) {+ return data;+ }++ if (this.getOption('includeShared')) {+ if (!data.bool) {+ data.bool = {};+ }++ data.bool.shared = true;+ }++ return data;}afterRender() {@@ -172,7 +195,7 @@ class RecordListDashletView extends BaseDashletView {name: 'create',text: this.translate('Create ' + this.scope, 'labels', this.scope),iconHtml: '<span class="fas fa-plus"></span>',- url: '#'+this.scope+'/create',+ url: `#${this.scope}/create`,});}}diff --git a/client/src/views/dashlets/options/base.js b/client/src/views/dashlets/options/base.jsindex e3da748309..65dee74a7c 100644--- a/client/src/views/dashlets/options/base.js+++ b/client/src/views/dashlets/options/base.js@@ -36,8 +36,23 @@ class BaseDashletOptionsModalView extends ModalView {cssName = 'options-modal'className = 'dialog dialog-record'- name = ''++ /**+ * @protected+ * @type {string}+ */+ name++ /**+ * @protected+ * @type {boolean}+ */escapeDisabled = true++ /**+ * @protected+ * @type {boolean}+ */saveDisabled = false;buttonList = [diff --git a/client/src/views/dashlets/options/record-list.js b/client/src/views/dashlets/options/record-list.jsnew file mode 100644index 0000000000..7f95e04b29--- /dev/null+++ b/client/src/views/dashlets/options/record-list.js@@ -0,0 +1,50 @@+/************************************************************************+ * This file is part of EspoCRM.+ *+ * EspoCRM – Open Source CRM application.+ * Copyright (C) 2014-2025 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko+ * Website: https://www.espocrm.com+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as published by+ * the Free Software Foundation, either version 3 of the License, or+ * (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ * The interactive user interfaces in modified source and object code versions+ * of this program must display Appropriate Legal Notices, as required under+ * Section 5 of the GNU Affero General Public License version 3.+ *+ * In accordance with Section 7(b) of the GNU Affero General Public License version 3,+ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word.+ ************************************************************************/++import BaseDashletOptionsModalView from 'views/dashlets/options/base';++export default class RecordListDashletOptionsModalView extends BaseDashletOptionsModalView {++ /**+ * @protected+ * @type {boolean}+ */+ hasCollaborators++ setup() {+ const entityType = this.getMetadata().get(`dashlets.${this.name}.entityType`);++ this.hasCollaborators = entityType && !!this.getMetadata().get(`scopes.${entityType}.collaborators`);++ super.setup();++ if (!this.hasCollaborators) {+ this.getRecordView().hideField('includeShared');+ }+ }+}