EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
ref
Yuri Kuznetsovec5e173e4038
diff --git a/client/src/views/admin/layouts/relationships.js b/client/src/views/admin/layouts/relationships.jsdeleted file mode 100644index 3efb620207..0000000000--- a/client/src/views/admin/layouts/relationships.js+++ /dev/null@@ -1,214 +0,0 @@-/************************************************************************- * 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.- ************************************************************************/--/**- * @deprecated- */-define('views/admin/layouts/relationships', ['views/admin/layouts/rows'], function (Dep) {-- return Dep.extend({-- dataAttributeList: [- 'name',- 'dynamicLogicVisible',- 'style',- 'dynamicLogicStyled',- ],-- editable: true,-- dataAttributesDefs: {- style: {- type: 'enum',- options: [- 'default',- 'success',- 'danger',- 'warning',- 'info',- ],- translation: 'LayoutManager.options.style',- },- dynamicLogicVisible: {- type: 'base',- view: 'views/admin/field-manager/fields/dynamic-logic-conditions',- tooltip: 'dynamicLogicVisible',- },- dynamicLogicStyled: {- type: 'base',- view: 'views/admin/field-manager/fields/dynamic-logic-conditions',- tooltip: 'dynamicLogicStyled',- },- name: {- readOnly: true,- },- },-- languageCategory: 'links',-- setup: function () {- Dep.prototype.setup.call(this);-- this.dataAttributesDefs = Espo.Utils.cloneDeep(this.dataAttributesDefs);-- this.dataAttributesDefs.dynamicLogicVisible.scope = this.scope;- this.dataAttributesDefs.dynamicLogicStyled.scope = this.scope;-- this.wait(true);-- this.loadLayout(() => {- this.wait(false);- });- },-- loadLayout: function (callback) {- this.getModelFactory().create(this.scope, (model) => {- this.getHelper().layoutManager.getOriginal(this.scope, this.type, this.setId, (layout) => {-- let allFields = [];-- for (let field in model.defs.links) {- if (['hasMany', 'hasChildren'].indexOf(model.defs.links[field].type) !== -1) {- if (this.isLinkEnabled(model, field)) {- allFields.push(field);- }- }- }-- allFields.sort((v1, v2) => {- return this.translate(v1, 'links', this.scope)- .localeCompare(this.translate(v2, 'links', this.scope));- });-- allFields.push('_delimiter_');-- this.enabledFieldsList = [];-- this.enabledFields = [];- this.disabledFields = [];-- for (let i in layout) {- let item = layout[i];- let o;-- if (typeof item == 'string' || item instanceof String) {- o = {- name: item,- labelText: this.getLanguage().translate(item, 'links', this.scope)- };- }- else {- o = item;-- o.labelText = this.getLanguage().translate(o.name, 'links', this.scope);- }-- if (o.name[0] === '_') {- o.notEditable = true;-- if (o.name === '_delimiter_') {- o.labelText = '. . .';- }- }-- this.dataAttributeList.forEach(attribute => {- if (attribute === 'name') {- return;- }-- if (attribute in o) {- return;- }-- var value = this.getMetadata()- .get(['clientDefs', this.scope, 'relationshipPanels', o.name, attribute]);-- if (value === null) {- return;- }-- o[attribute] = value;- });-- this.enabledFields.push(o);- this.enabledFieldsList.push(o.name);- }-- for (let i in allFields) {- if (!_.contains(this.enabledFieldsList, allFields[i])) {- var name = allFields[i];-- var label = this.getLanguage().translate(name, 'links', this.scope);-- let o = {- name: name,- labelText: label,- };-- if (o.name[0] === '_') {- o.notEditable = true;-- if (o.name === '_delimiter_') {- o.labelText = '. . .';- }- }-- this.disabledFields.push(o);- }- }-- this.rowLayout = this.enabledFields;-- for (let i in this.rowLayout) {- let o = this.rowLayout[i];-- o.labelText = this.getLanguage().translate(this.rowLayout[i].name, 'links', this.scope);-- if (o.name === '_delimiter_') {- o.labelText = '. . .';- }-- this.itemsData[this.rowLayout[i].name] = Espo.Utils.cloneDeep(this.rowLayout[i]);- }-- callback();- });- });- },-- validate: function () {- return true;- },-- isLinkEnabled: function (model, name) {- return !model.getLinkParam(name, 'disabled') &&- !model.getLinkParam(name, 'utility') &&- !model.getLinkParam(name, 'layoutRelationshipsDisabled');- },- });-});diff --git a/client/src/views/record/row-actions/default.js b/client/src/views/record/row-actions/default.jsindex d0b9e79016..ef54caeffd 100644--- a/client/src/views/record/row-actions/default.js+++ b/client/src/views/record/row-actions/default.js@@ -64,11 +64,35 @@ class DefaultRowActionsView extends View {*/lastActionList+ /**+ * @private+ * @type {Object.<string, {isAvailable: function(module:model, string)}>}+ */+ handlers++ /**+ * @param {{+ * acl?: {+ * edit?: boolean,+ * detete?: boolean,+ * },+ * model: import('model').default,+ * rowActionHandlers?: Object.<string, {isAvailable: function(module:model, string)}>,+ * additionalActionList?: string[],+ * scope?: string,+ * } & Record} options+ */+ constructor(options) {+ super(options);++ this.options = options;+ }+setup() {this.options.acl = this.options.acl || {};this.scope = this.options.scope || this.model.entityType;- /** @type {Object.<string, {isAvailable: function(module:model, string)}>} */+ // noinspection JSValidateTypesthis.handlers = this.options.rowActionHandlers || {};/** @type {module:views/record/row-actions/actions~item[]} */@@ -255,7 +279,6 @@ class DefaultRowActionsView extends View {}setupAdditionalActions() {- /** @type {string[]} */const list = this.options.additionalActionList;if (!list) {diff --git a/client/src/views/record/row-actions/relationship-no-remove.js b/client/src/views/record/row-actions/relationship-no-remove.jsindex 5878da1bb6..4658236064 100644--- a/client/src/views/record/row-actions/relationship-no-remove.js+++ b/client/src/views/record/row-actions/relationship-no-remove.js@@ -26,46 +26,47 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('views/record/row-actions/relationship-no-remove', ['views/record/row-actions/relationship'], function (Dep) {+import RelationshipRowActionsView from 'views/record/row-actions/relationship';- return Dep.extend({+// noinspection JSUnusedGlobalSymbols+export default class UserRelationshipNoRemoveRowActionsView extends RelationshipRowActionsView {- getActionList: function () {- var list = [{- action: 'quickView',- label: 'View',+ getActionList() {+ const list = [];++ list.push({+ action: 'quickView',+ label: 'View',+ data: {+ id: this.model.id+ },+ link: `#${this.model.entityType}/view/${this.model.id}`,+ groupIndex: 0,+ });++ if (this.options.acl.edit) {+ list.push({+ action: 'quickEdit',+ label: 'Edit',data: {- id: this.model.id+ id: this.model.id,},- link: '#' + this.model.entityType + '/view/' + this.model.id,+ link: `#${this.model.entityType}/edit/${this.model.id}`,groupIndex: 0,- }];+ });- if (this.options.acl.edit) {+ if (!this.options.unlinkDisabled) {list.push({- action: 'quickEdit',- label: 'Edit',+ action: 'unlinkRelated',+ label: 'Unlink',data: {- id: this.model.id+ id: this.model.id,},- link: '#' + this.model.entityType + '/edit/' + this.model.id,groupIndex: 0,});-- if (!this.options.unlinkDisabled) {- list.push({- action: 'unlinkRelated',- label: 'Unlink',- data: {- id: this.model.id- },- groupIndex: 0,- });- }}+ }- return list;- },-- });-});+ return list;+ }+}diff --git a/client/src/views/record/row-actions/relationship.js b/client/src/views/record/row-actions/relationship.jsindex 80109bbdb9..7bfad992c3 100644--- a/client/src/views/record/row-actions/relationship.js+++ b/client/src/views/record/row-actions/relationship.js@@ -28,7 +28,7 @@import DefaultRowActionsView from 'views/record/row-actions/default';-class RelationshipActionsView extends DefaultRowActionsView {+class RelationshipRowActionsView extends DefaultRowActionsView {getActionList() {const list = [{@@ -81,4 +81,4 @@ class RelationshipActionsView extends DefaultRowActionsView {}}-export default RelationshipActionsView;+export default RelationshipRowActionsView;diff --git a/client/src/views/user/record/detail-quick-side.js b/client/src/views/user/record/detail-quick-side.jsindex 1dbfcceebd..d1b020033c 100644--- a/client/src/views/user/record/detail-quick-side.js+++ b/client/src/views/user/record/detail-quick-side.js@@ -26,13 +26,13 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('views/user/record/detail-quick-side',-['views/record/detail-side', 'views/user/record/detail-side'], function (Dep, UserDetailSide) {+import DetailSideRecordView from 'views/record/detail-side';+import UserDetailSideRecordView from 'views/user/record/detail-side';- return Dep.extend({+// noinspection JSUnusedGlobalSymbols+export default class extends DetailSideRecordView {- setupPanels: function () {- UserDetailSide.prototype.setupPanels.call(this);- },- });-});+ setupPanels () {+ UserDetailSideRecordView.prototype.setupPanels.call(this);+ }+}diff --git a/client/src/views/user/record/detail-quick.js b/client/src/views/user/record/detail-quick.jsindex 3d43ee4f65..4f6cefbbf5 100644--- a/client/src/views/user/record/detail-quick.js+++ b/client/src/views/user/record/detail-quick.js@@ -26,25 +26,24 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('views/user/record/detail-quick',-['views/record/detail-small', 'views/user/record/detail'], function (Dep, Detail) {+import DetailRecordView from 'views/record/detail';+import UserDetailRecordView from 'views/user/record/detail';- return Dep.extend({+export default class extends DetailRecordView {- sideView: 'views/user/record/detail-quick-side',+ sideView = 'views/user/record/detail-quick-side'- bottomView: null,+ bottomView = null- editModeEnabled: false,+ setup() {+ super.setup();- setup: function () {- Dep.prototype.setup.call(this);- Detail.prototype.setupNonAdminFieldsAccess.call(this);- Detail.prototype.setupFieldAppearance.call(this);- },+ UserDetailRecordView.prototype.setupNonAdminFieldsAccess.call(this);+ UserDetailRecordView.prototype.setupFieldAppearance.call(this);+ }- controlFieldAppearance: function () {- Detail.prototype.controlFieldAppearance.call(this);- },- });-});+ // noinspection JSUnusedGlobalSymbols+ controlFieldAppearance() {+ UserDetailRecordView.prototype.controlFieldAppearance.call(this);+ }+}diff --git a/client/src/views/user/record/edit-quick.js b/client/src/views/user/record/edit-quick.jsindex 35b0527f7a..5522f3faed 100644--- a/client/src/views/user/record/edit-quick.js+++ b/client/src/views/user/record/edit-quick.js@@ -26,20 +26,22 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('views/user/record/edit-quick', ['views/record/edit-small', 'views/user/record/detail'], function (Dep, Detail) {+import EditRecordView from 'views/record/edit';+import UserDetailRecordView from 'views/user/record/detail';- return Dep.extend({+export default class extends EditRecordView {- sideView: 'views/user/record/edit-side',+ sideView = 'views/record/edit-side'- setup: function () {- Dep.prototype.setup.call(this);- Detail.prototype.setupNonAdminFieldsAccess.call(this);- Detail.prototype.setupFieldAppearance.call(this);- },+ setup() {+ super.setup();- controlFieldAppearance: function () {- Detail.prototype.controlFieldAppearance.call(this);- },- });-});+ UserDetailRecordView.prototype.setupNonAdminFieldsAccess.call(this);+ UserDetailRecordView.prototype.setupFieldAppearance.call(this);+ }++ // noinspection JSUnusedGlobalSymbols+ controlFieldAppearance() {+ UserDetailRecordView.prototype.controlFieldAppearance.call(this);+ }+}diff --git a/client/src/views/user/record/edit-side.js b/client/src/views/user/record/edit-side.jsdeleted file mode 100644index 3193af1a9b..0000000000--- a/client/src/views/user/record/edit-side.js+++ /dev/null@@ -1,35 +0,0 @@-/************************************************************************- * 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.- ************************************************************************/--define('views/user/record/edit-side', ['views/record/edit-side'], function (Dep) {-- return Dep.extend({-- });-});-diff --git a/client/src/views/user/record/edit.js b/client/src/views/user/record/edit.jsindex e1a2259c07..08396432ec 100644--- a/client/src/views/user/record/edit.js+++ b/client/src/views/user/record/edit.js@@ -31,8 +31,6 @@ import UserDetailRecordView from 'views/user/record/detail';class UserEditRecordView extends EditRecordView {- sideView = 'views/user/record/edit-side'-/*** @name model* @type module:models/userdiff --git a/client/src/views/user/record/list.js b/client/src/views/user/record/list.jsindex 570610421d..04c3c21dc9 100644--- a/client/src/views/user/record/list.js+++ b/client/src/views/user/record/list.js@@ -26,46 +26,44 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('views/user/record/list', ['views/record/list'], function (Dep) {+import ListRecordView from 'views/record/list';- return Dep.extend({+export default class UserListRecordView extends ListRecordView {- quickEditDisabled: true,+ rowActionsView = 'views/user/record/row-actions/default'- rowActionsView: 'views/user/record/row-actions/default',+ quickEditDisabled = true+ massActionList = ['remove', 'massUpdate', 'export']+ checkAllResultMassActionList = ['massUpdate', 'export']- massActionList: ['remove', 'massUpdate', 'export'],+ setupMassActionItems() {+ super.setupMassActionItems();- checkAllResultMassActionList: ['massUpdate', 'export'],+ if (this.scope === 'ApiUser') {+ this.removeMassAction('massUpdate');+ this.removeMassAction('export');- setupMassActionItems: function () {- Dep.prototype.setupMassActionItems.call(this);+ this.layoutName = 'listApi';+ }- if (this.scope === 'ApiUser') {- this.removeMassAction('massUpdate');- this.removeMassAction('export');+ if (this.scope === 'PortalUser') {+ this.layoutName = 'listPortal';+ }- this.layoutName = 'listApi';- }+ if (!this.getUser().isAdmin()) {+ this.removeMassAction('massUpdate');+ this.removeMassAction('export');+ }+ }- if (this.scope === 'PortalUser') {- this.layoutName = 'listPortal';- }+ getModelScope(id) {+ const model = /** @type {import('models/user').default} */+ this.collection.get(id);- if (!this.getUser().isAdmin()) {- this.removeMassAction('massUpdate');- this.removeMassAction('export');- }- },+ if (model.isPortal()) {+ return 'PortalUser';+ }- getModelScope: function (id) {- var model = this.collection.get(id);-- if (model.isPortal()) {- return 'PortalUser';- }-- return this.scope;- },- });-});+ return this.scope;+ }+}diff --git a/client/src/views/user/record/row-actions/default.js b/client/src/views/user/record/row-actions/default.jsindex f6e57b882a..b5c3e6aeac 100644--- a/client/src/views/user/record/row-actions/default.js+++ b/client/src/views/user/record/row-actions/default.js@@ -26,42 +26,44 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('views/user/record/row-actions/default', ['views/record/row-actions/default'], function (Dep) {+import DefaultRowActionsView from 'views/record/row-actions/default';- return Dep.extend({+export default class UserDefaultRowActionsView extends DefaultRowActionsView {- getActionList: function () {- var scope = 'User';- if (this.model.isPortal()) {- scope = 'PortalUser';- } else if (this.model.isApi()) {- scope = 'ApiUser';- }+ getActionList() {+ let scope = 'User';- var list = [{- action: 'quickView',- label: 'View',+ const model = /** @type {import('models/user').default} */this.model;++ if (model.isPortal()) {+ scope = 'PortalUser';+ } else if (model.isApi()) {+ scope = 'ApiUser';+ }++ const list = [{+ action: 'quickView',+ label: 'View',+ data: {+ id: this.model.id,+ scope: scope,+ },+ link: `#${scope}/view/${this.model.id}`,+ }];++ if (this.options.acl.edit) {+ list.push({+ action: 'quickEdit',+ label: 'Edit',data: {id: this.model.id,- scope: scope+ scope: scope,},- link: '#' + scope + '/view/' + this.model.id- }];-- if (this.options.acl.edit) {- list.push({- action: 'quickEdit',- label: 'Edit',- data: {- id: this.model.id,- scope: scope- },- link: '#' + scope + '/edit/' + this.model.id- });- }+ link: `#${scope}/edit/${this.model.id}`,+ });+ }- return list;- },- });-});+ return list;+ }+}diff --git a/client/src/views/user/record/row-actions/relationship-followers.js b/client/src/views/user/record/row-actions/relationship-followers.jsindex 6211400abb..4542cebf56 100644--- a/client/src/views/user/record/row-actions/relationship-followers.js+++ b/client/src/views/user/record/row-actions/relationship-followers.js@@ -26,36 +26,40 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-define('views/user/record/row-actions/relationship-followers', ['views/record/row-actions/relationship'], function (Dep) {+import RelationshipRowActionsView from 'views/record/row-actions/relationship';- return Dep.extend({+// noinspection JSUnusedGlobalSymbols+export default class UserRelationshipFollowersRowActionsView extends RelationshipRowActionsView {- getActionList: function () {- var list = [{- action: 'quickView',- label: 'View',- data: {- id: this.model.id- },- link: '#' + this.model.entityType + '/view/' + this.model.id- }];+ getActionList() {+ const list = [];++ const model = /** @type {import('models/user').default} */this.model;- if (- this.getUser().isAdmin() ||- this.getAcl().get('followerManagementPermission') !== 'no' ||- this.model.isPortal() && this.getAcl().get('portalPermission') === 'yes' ||- this.model.id === this.getUser().id- ) {- list.push({- action: 'unlinkRelated',- label: 'Unlink',- data: {- id: this.model.id- }- });- }+ list.push({+ action: 'quickView',+ label: 'View',+ data: {+ id: this.model.id,+ },+ link: `#${this.model.entityType}/view/${this.model.id}`+ })- return list;+ if (+ this.getUser().isAdmin() ||+ this.getAcl().getPermissionLevel('followerManagementPermission') !== 'no' ||+ model.isPortal() && this.getAcl().getPermissionLevel('portalPermission') === 'yes' ||+ this.model.id === this.getUser().id+ ) {+ list.push({+ action: 'unlinkRelated',+ label: 'Unlink',+ data: {+ id: this.model.id,+ },+ });}- });-});++ return list;+ }+}