name => entityType

This commit is contained in:
Yuri Kuznetsov
2023-07-08 14:22:05 +03:00
parent ece7d1f3b4
commit b11bfb0e92
88 changed files with 206 additions and 200 deletions
@@ -1100,7 +1100,7 @@ class CalendarView extends View {
addModel(model) {
let d = model.getClonedAttributes();
d.scope = model.name;
d.scope = model.entityType;
let event = this.convertToFcEvent(d);
@@ -1108,7 +1108,7 @@ class CalendarView extends View {
}
updateModel(model) {
let eventId = model.name + '-' + model.id;
let eventId = model.entityType + '-' + model.id;
let event = this.calendar.getEventById(eventId);
@@ -1118,7 +1118,7 @@ class CalendarView extends View {
let attributes = model.getClonedAttributes();
attributes.scope = model.name;
attributes.scope = model.entityType;
let data = this.convertToFcEvent(attributes);
@@ -1181,7 +1181,7 @@ class CalendarView extends View {
}
removeModel(model) {
let event = this.calendar.getEventById(model.name + '-' + model.id);
let event = this.calendar.getEventById(model.entityType + '-' + model.id);
if (!event) {
return;
@@ -57,7 +57,7 @@ define('crm:views/call/record/row-actions/dashlet', ['views/record/row-actions/v
label: 'Remove',
data: {
id: this.model.id,
scope: this.model.name
scope: this.model.entityType
}
});
}
@@ -56,7 +56,7 @@ define('crm:views/call/record/row-actions/default', ['views/record/row-actions/v
label: 'Remove',
data: {
id: this.model.id,
scope: this.model.name
scope: this.model.entityType
}
});
}
+1 -1
View File
@@ -35,7 +35,7 @@ define('crm:views/lead/convert', ['view'], function (Dep) {
data: function () {
return {
scopeList: this.scopeList,
scope: this.model.name,
scope: this.model.entityType,
};
},
+1 -1
View File
@@ -56,7 +56,7 @@ define('crm:views/lead/detail', ['views/detail'], function (Dep) {
},
actionConvert: function () {
this.getRouter().navigate(this.model.name + '/convert/' + this.model.id , {trigger: true});
this.getRouter().navigate(this.model.entityType + '/convert/' + this.model.id , {trigger: true});
},
});
});
@@ -71,7 +71,7 @@ function (Dep, /** module:ui/select*/Select, moment) {
},
setup: function () {
if (this.model.isNew() && !this.model.get(this.name) && this.model.name !== 'Preferences') {
if (this.model.isNew() && !this.model.get(this.name) && this.model.entityType !== 'Preferences') {
this.reminderList = this.getPreferences().get('defaultReminders') || [];
} else {
this.reminderList = this.model.get(this.name) || [];
@@ -35,7 +35,7 @@ define('crm:views/meeting/record/row-actions/dashlet', ['views/record/row-action
actionList.forEach(item => {
item.data = item.data || {};
item.data.scope = this.model.name;
item.data.scope = this.model.entityType;
});
if (this.options.acl.edit && !~['Held', 'Not Held'].indexOf(this.model.get('status'))) {
@@ -44,7 +44,7 @@ define('crm:views/meeting/record/row-actions/dashlet', ['views/record/row-action
label: 'Set Held',
data: {
id: this.model.id,
scope: this.model.name,
scope: this.model.entityType,
}
});
@@ -53,7 +53,7 @@ define('crm:views/meeting/record/row-actions/dashlet', ['views/record/row-action
label: 'Set Not Held',
data: {
id: this.model.id,
scope: this.model.name,
scope: this.model.entityType,
}
});
}
@@ -64,7 +64,7 @@ define('crm:views/meeting/record/row-actions/dashlet', ['views/record/row-action
label: 'Remove',
data: {
id: this.model.id,
scope: this.model.name,
scope: this.model.entityType,
}
});
}
@@ -35,7 +35,7 @@ define('crm:views/meeting/record/row-actions/default', ['views/record/row-action
actionList.forEach(item => {
item.data = item.data || {};
item.data.scope = this.model.name;
item.data.scope = this.model.entityType;
});
if (this.options.acl.edit && !~['Held', 'Not Held'].indexOf(this.model.get('status'))) {
@@ -44,7 +44,7 @@ define('crm:views/meeting/record/row-actions/default', ['views/record/row-action
label: 'Set Held',
data: {
id: this.model.id,
scope: this.model.name,
scope: this.model.entityType,
}
});
@@ -53,7 +53,7 @@ define('crm:views/meeting/record/row-actions/default', ['views/record/row-action
label: 'Set Not Held',
data: {
id: this.model.id,
scope: this.model.name,
scope: this.model.entityType,
}
});
}
@@ -64,7 +64,7 @@ define('crm:views/meeting/record/row-actions/default', ['views/record/row-action
label: 'Remove',
data: {
id: this.model.id,
scope: this.model.name,
scope: this.model.entityType,
}
});
}
@@ -98,7 +98,7 @@ define('crm:views/record/panels/activities',
}
});
this.url = this.serviceName + '/' + this.model.name + '/' + this.model.id + '/' + this.name;
this.url = this.serviceName + '/' + this.model.entityType + '/' + this.model.id + '/' + this.name;
this.seeds = {};
@@ -226,8 +226,8 @@ define('crm:views/record/panels/activities',
o.data.scope = scope;
if (
this.model.name !== 'User' &&
!this.checkParentTypeAvailability(scope, this.model.name)
this.model.entityType !== 'User' &&
!this.checkParentTypeAvailability(scope, this.model.entityType)
) {
return;
}
@@ -378,7 +378,7 @@ define('crm:views/record/panels/activities',
status: data.status,
};
if (this.model.name === 'User') {
if (this.model.entityType === 'User') {
if (this.model.isPortal()) {
attributes.usersIds = [this.model.id];
@@ -392,7 +392,7 @@ define('crm:views/record/panels/activities',
}
}
else {
if (this.model.name === 'Contact') {
if (this.model.entityType === 'Contact') {
if (this.model.get('accountId') && !this.getConfig().get('b2cMode')) {
attributes.parentType = 'Account';
attributes.parentId = this.model.get('accountId');
@@ -408,21 +408,21 @@ define('crm:views/record/panels/activities',
}
}
}
else if (this.model.name === 'Lead') {
else if (this.model.entityType === 'Lead') {
attributes.parentType = 'Lead';
attributes.parentId = this.model.id;
attributes.parentName = this.model.get('name');
}
if (this.model.name !== 'Account' && this.model.has('contactsIds')) {
if (this.model.entityType !== 'Account' && this.model.has('contactsIds')) {
attributes.contactsIds = this.model.get('contactsIds');
attributes.contactsNames = this.model.get('contactsNames');
}
if (scope) {
if (!attributes.parentId) {
if (this.checkParentTypeAvailability(scope, this.model.name)) {
attributes.parentType = this.model.name;
if (this.checkParentTypeAvailability(scope, this.model.entityType)) {
attributes.parentType = this.model.entityType;
attributes.parentId = this.model.id;
attributes.parentName = this.model.get('name');
}
@@ -509,7 +509,7 @@ define('crm:views/record/panels/activities',
to: this.model.get('emailAddress')
};
if (this.model.name === 'Contact') {
if (this.model.entityType === 'Contact') {
if (this.getConfig().get('b2cMode')) {
attributes.parentType = 'Contact';
attributes.parentName = this.model.get('name');
@@ -517,27 +517,27 @@ define('crm:views/record/panels/activities',
}
else {
if (this.model.get('accountId')) {
attributes.parentType = 'Account',
attributes.parentType = 'Account';
attributes.parentId = this.model.get('accountId');
attributes.parentName = this.model.get('accountName');
}
}
}
else if (this.model.name === 'Lead') {
attributes.parentType = 'Lead',
attributes.parentId = this.model.id
else if (this.model.entityType === 'Lead') {
attributes.parentType = 'Lead';
attributes.parentId = this.model.id;
attributes.parentName = this.model.get('name');
}
if (~['Contact', 'Lead', 'Account'].indexOf(this.model.name) && this.model.get('emailAddress')) {
if (~['Contact', 'Lead', 'Account'].indexOf(this.model.entityType) && this.model.get('emailAddress')) {
attributes.nameHash = {};
attributes.nameHash[this.model.get('emailAddress')] = this.model.get('name');
}
if (scope) {
if (!attributes.parentId) {
if (this.checkParentTypeAvailability(scope, this.model.name)) {
attributes.parentType = this.model.name;
if (this.checkParentTypeAvailability(scope, this.model.entityType)) {
attributes.parentType = this.model.entityType;
attributes.parentId = this.model.id;
attributes.parentName = this.model.get('name');
}
@@ -555,7 +555,7 @@ define('crm:views/record/panels/activities',
if (
attributes.parentType &&
attributes.parentType === this.model.name &&
attributes.parentType === this.model.entityType &&
~emailKeepParentTeamsEntityList.indexOf(attributes.parentType) &&
this.model.get('teamsIds') &&
this.model.get('teamsIds').length
@@ -649,7 +649,7 @@ define('crm:views/record/panels/activities',
},
actionViewRelatedList: function (data) {
data.url = 'Activities/' + this.model.name + '/' +
data.url = 'Activities/' + this.model.entityType + '/' +
this.model.id + '/' + this.name + '/list/' + data.scope;
data.title = this.translate(this.defs.label) +
@@ -84,7 +84,7 @@ define('crm:views/record/panels/history', ['crm:views/record/panels/activities']
to: this.getUser().get('emailAddress'),
};
if (this.model.name === 'Contact') {
if (this.model.entityType === 'Contact') {
if (this.getConfig().get('b2cMode')) {
attributes.parentType = 'Contact';
attributes.parentName = this.model.get('name');
@@ -96,7 +96,7 @@ define('crm:views/record/panels/history', ['crm:views/record/panels/activities']
attributes.parentName = this.model.get('accountName');
}
}
} else if (this.model.name === 'Lead') {
} else if (this.model.entityType === 'Lead') {
attributes.parentType = 'Lead';
attributes.parentId = this.model.id
attributes.parentName = this.model.get('name');
@@ -107,8 +107,8 @@ define('crm:views/record/panels/history', ['crm:views/record/panels/activities']
if (scope) {
if (!attributes.parentId) {
if (this.checkParentTypeAvailability(scope, this.model.name)) {
attributes.parentType = this.model.name;
if (this.checkParentTypeAvailability(scope, this.model.entityType)) {
attributes.parentType = this.model.entityType;
attributes.parentId = this.model.id;
attributes.parentName = this.model.get('name');
}
@@ -36,7 +36,7 @@ define('crm:views/record/panels/target-lists', ['views/record/panels/relationshi
.postRequest('TargetList/action/optOut', {
id: data.id,
targetId: this.model.id,
targetType: this.model.name,
targetType: this.model.entityType,
})
.then(() => {
this.collection.fetch();
@@ -52,7 +52,7 @@ define('crm:views/record/panels/target-lists', ['views/record/panels/relationshi
.postRequest('TargetList/action/cancelOptOut', {
id: data.id,
targetId: this.model.id,
targetType: this.model.name,
targetType: this.model.entityType,
})
.then(() => {
this.collection.fetch();
@@ -81,7 +81,7 @@ define('crm:views/record/panels/tasks', ['views/record/panels/relationship'], fu
},
setup: function () {
this.parentScope = this.model.name;
this.parentScope = this.model.entityType;
this.link = 'tasks';
this.panelName = 'tasksSide';
@@ -92,7 +92,7 @@ define('crm:views/record/panels/tasks', ['views/record/panels/relationship'], fu
this.link = 'tasksPrimary';
}
this.url = this.model.name + '/' + this.model.id + '/' + this.link;
this.url = this.model.entityType + '/' + this.model.id + '/' + this.link;
this.setupSorting();
@@ -33,11 +33,11 @@ define('crm:views/record/row-actions/activities-dashlet', ['views/record/row-act
getActionList: function () {
var actionList = Dep.prototype.getActionList.call(this);
var scope = this.model.name;
var scope = this.model.entityType;
actionList.forEach(function (item) {
item.data = item.data || {};
item.data.scope = this.model.name;
item.data.scope = this.model.entityType;
}, this);
if (scope === 'Task') {
@@ -57,7 +57,7 @@ define('crm:views/record/row-actions/activities-dashlet', ['views/record/row-act
label: 'Set Held',
data: {
id: this.model.id,
scope: this.model.name
scope: this.model.entityType
}
});
actionList.push({
@@ -65,7 +65,7 @@ define('crm:views/record/row-actions/activities-dashlet', ['views/record/row-act
label: 'Set Not Held',
data: {
id: this.model.id,
scope: this.model.name
scope: this.model.entityType
}
});
}
@@ -77,7 +77,7 @@ define('crm:views/record/row-actions/activities-dashlet', ['views/record/row-act
label: 'Remove',
data: {
id: this.model.id,
scope: this.model.name
scope: this.model.entityType
}
});
}
@@ -37,7 +37,7 @@ define('crm:views/record/row-actions/activities', ['views/record/row-actions/rel
data: {
id: this.model.id,
},
link: '#' + this.model.name + '/view/' + this.model.id,
link: '#' + this.model.entityType + '/view/' + this.model.id,
}];
if (this.options.acl.edit) {
@@ -47,7 +47,7 @@ define('crm:views/record/row-actions/activities', ['views/record/row-actions/rel
data: {
id: this.model.id,
},
link: '#' + this.model.name + '/edit/' + this.model.id,
link: '#' + this.model.entityType + '/edit/' + this.model.id,
});
if (this.model.entityType === 'Meeting' || this.model.entityType === 'Call') {
@@ -37,7 +37,7 @@ define('crm:views/record/row-actions/history', ['views/record/row-actions/relati
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}];
if (this.model.entityType === 'Email') {
@@ -58,7 +58,7 @@ define('crm:views/record/row-actions/history', ['views/record/row-actions/relati
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
link: '#' + this.model.entityType + '/edit/' + this.model.id
}
]);
}
@@ -37,7 +37,7 @@ define('crm:views/record/row-actions/tasks', ['views/record/row-actions/relation
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}];
if (this.options.acl.edit) {
@@ -47,7 +47,7 @@ define('crm:views/record/row-actions/tasks', ['views/record/row-actions/relation
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
link: '#' + this.model.entityType + '/edit/' + this.model.id
});
if (!~['Completed', 'Canceled'].indexOf(this.model.get('status'))) {
@@ -45,7 +45,7 @@ function (Dep, MultiCollection) {
},
getStorageKey: function () {
return 'target-list-opted-out-' + this.model.name + '-' + this.name;
return 'target-list-opted-out-' + this.model.entityType + '-' + this.name;
},
setup: function () {
@@ -40,7 +40,7 @@ define('crm:views/target-list/record/row-actions/default', ['views/record/row-ac
label: 'Cancel Opt-Out',
data: {
id: this.model.id,
type: this.model.name,
type: this.model.entityType,
},
});
} else {
@@ -49,7 +49,7 @@ define('crm:views/target-list/record/row-actions/default', ['views/record/row-ac
label: 'Opt-Out',
data: {
id: this.model.id,
type: this.model.name,
type: this.model.entityType,
},
});
}
@@ -37,7 +37,7 @@ define('crm:views/target-list/record/row-actions/opted-out', ['views/record/row-
label: 'Cancel Opt-Out',
data: {
id: this.model.id,
type: this.model.name
type: this.model.entityType,
},
},
];
@@ -49,7 +49,7 @@ define('crm:views/task/record/row-actions/dashlet', ['views/record/row-actions/v
label: 'Remove',
data: {
id: this.model.id,
scope: this.model.name
scope: this.model.entityType
}
});
}
@@ -49,7 +49,7 @@ define('crm:views/task/record/row-actions/default', ['views/record/row-actions/v
label: 'Remove',
data: {
id: this.model.id,
scope: this.model.name
scope: this.model.entityType
}
});
}
@@ -1,5 +1,5 @@
<a
href="#{{model.name}}/view/{{model.id}}"
href="#{{model.entityType}}/view/{{model.id}}"
class="link"
data-id="{{model.id}}"
title="{{value}}"
@@ -15,7 +15,7 @@
<span data-name="white-space" data-id="{{model.id}}" class="empty-icon{{#unless isEnd}} hidden{{/unless}}">&nbsp;</span>
<a href="#{{model.name}}/view/{{model.id}}"
<a href="#{{model.entityType}}/view/{{model.id}}"
class="link{{#if isSelected}} text-bold{{/if}}" data-id="{{model.id}}" title="{{name}}"
>{{name}}</a>
+1 -1
View File
@@ -9,7 +9,7 @@
>
<span
class="label-text"
>{{#if labelText}}{{labelText}}{{else}}{{translate label scope=../model.name category='fields'}}{{/if}}</span>
>{{#if labelText}}{{labelText}}{{else}}{{translate label scope=../model.entityType category='fields'}}{{/if}}</span>
</label>
{{/unless}}
<div class="field{{#if hidden}} hidden{{/if}}" data-name="{{name}}">
+3 -3
View File
@@ -223,7 +223,7 @@ class AclManager {
* @returns {boolean|null} True if access allowed, null if not enough data to determine.
*/
checkModel(model, action, precise) {
var scope = model.name;
let scope = model.entityType;
// todo move this to custom acl
if (action === 'edit') {
@@ -281,7 +281,7 @@ class AclManager {
* @returns {boolean|null} True if owner, null if not clear.
*/
checkIsOwner(model) {
return this.getImplementation(model.name).checkIsOwner(model);
return this.getImplementation(model.entityType).checkIsOwner(model);
}
// noinspection JSUnusedGlobalSymbols
@@ -292,7 +292,7 @@ class AclManager {
* @returns {boolean|null} True if in a team, null if not clear.
*/
checkInTeam(model) {
return this.getImplementation(model.name).checkInTeam(model);
return this.getImplementation(model.entityType).checkInTeam(model);
}
/**
+2 -2
View File
@@ -46,7 +46,7 @@ class AclPortalManager extends AclManager {
checkInAccount(model) {
const impl =
/** @type {module:acl-portal} */
this.getImplementation(model.name);
this.getImplementation(model.entityType);
return impl.checkInAccount(model);
}
@@ -61,7 +61,7 @@ class AclPortalManager extends AclManager {
checkIsOwnContact(model) {
const impl =
/** @type {module:acl-portal} */
this.getImplementation(model.name);
this.getImplementation(model.entityType);
return impl.checkIsOwnContact(model);
}
@@ -106,7 +106,7 @@ class DefaultsPopulator {
fillAssignedUser = true;
}
else if (
this.acl.getScopeForbiddenFieldList(model.name, 'edit').includes(assignedUserField)
this.acl.getScopeForbiddenFieldList(model.entityType, 'edit').includes(assignedUserField)
) {
fillAssignedUser = true;
}
+2 -2
View File
@@ -781,7 +781,7 @@ class Model {
setRelate(data) {
let setRelate = options => {
let link = options.link;
let model = options.model;
let model = /** @type {module:model} */options.model;
if (!link || !model) {
throw new Error('Bad related options');
@@ -792,7 +792,7 @@ class Model {
switch (type) {
case 'belongsToParent':
this.set(link + 'Id', model.id);
this.set(link + 'Type', model.name);
this.set(link + 'Type', model.entityType);
this.set(link + 'Name', model.get('name'));
break;
+11 -2
View File
@@ -86,10 +86,19 @@ class DetailView extends MainView {
/** @inheritDoc */
shortcutKeys = {}
/**
* An entity type.
*
* @type {string}
*/
entityType
/** @inheritDoc */
setup() {
super.setup();
this.entityType = this.model.entityType || this.model.name;
this.headerView = this.options.headerView || this.headerView;
this.recordView = this.options.recordView || this.recordView;
@@ -274,7 +283,7 @@ class DetailView extends MainView {
this.disableMenuItem('follow');
Espo.Ajax
.putRequest(this.model.name + '/' + this.model.id + '/subscription')
.putRequest(this.entityType + '/' + this.model.id + '/subscription')
.then(() => {
this.hideHeaderActionItem('follow');
@@ -295,7 +304,7 @@ class DetailView extends MainView {
this.disableMenuItem('unfollow');
Espo.Ajax
.deleteRequest(this.model.name + '/' + this.model.id + '/subscription')
.deleteRequest(this.entityType + '/' + this.model.id + '/subscription')
.then(() => {
this.hideHeaderActionItem('unfollow');
+1 -1
View File
@@ -423,7 +423,7 @@ define('views/email/record/detail', ['views/record/detail'], function (Dep) {
actionViewUsers: function (data) {
var viewName =
this.getMetadata()
.get(['clientDefs', this.model.name, 'relationshipPanels', 'users', 'viewModalView']) ||
.get(['clientDefs', this.model.entityType, 'relationshipPanels', 'users', 'viewModalView']) ||
this.getMetadata().get(['clientDefs', 'User', 'modalViews', 'relatedList']) ||
'views/modals/related-list';
+1 -1
View File
@@ -70,7 +70,7 @@ define('views/external-account/oauth2', ['view', 'model'], function (Dep, Model)
this.model = new Model();
this.model.id = this.id;
this.model.name = 'ExternalAccount';
this.model.entityType = this.model.name = 'ExternalAccount';
this.model.urlRoot = 'ExternalAccount';
this.model.defs = {
+2 -2
View File
@@ -578,7 +578,7 @@ class AddressFieldView extends BaseFieldView {
this[item + 'Field'] = attribute;
this[item + 'MaxLength'] =
this.getMetadata().get(['entityDefs', this.model.name, 'fields', attribute, 'maxLength']);
this.getMetadata().get(['entityDefs', this.entityType, 'fields', attribute, 'maxLength']);
});
}
@@ -587,7 +587,7 @@ class AddressFieldView extends BaseFieldView {
if (this.model.isRequired(name)) {
if (this.model.get(name) === '') {
let msg = this.translate('fieldIsRequired', 'messages')
.replace('{field}', this.translate(name, 'fields', this.model.name));
.replace('{field}', this.translate(name, 'fields', this.entityType));
this.showValidationMessage(msg, '[data-name="'+name+'"]');
@@ -535,7 +535,7 @@ class AttachmentMultipleFieldView extends BaseFieldView {
let attachment = model.clone();
attachment.set('role', 'Attachment');
attachment.set('parentType', this.model.name);
attachment.set('parentType', this.model.entityType);
attachment.set('field', this.name);
uploadHelper
@@ -839,7 +839,7 @@ class AttachmentMultipleFieldView extends BaseFieldView {
}
modelList.forEach(model => {
if (model.name === 'Attachment') {
if (model.entityType === 'Attachment') {
this.pushAttachment(model);
return;
+1 -1
View File
@@ -455,7 +455,7 @@ class BaseFieldView extends View {
/** @inheritDoc */
data() {
let data = {
scope: this.model.name,
scope: this.model.entityType || this.model.name,
name: this.name,
defs: this.defs,
params: this.params,
+1 -1
View File
@@ -441,7 +441,7 @@ class DateFieldView extends BaseFieldView {
if (moment(value).unix() <= moment(otherValue).unix()) {
let msg = this.translate('fieldShouldAfter', 'messages')
.replace('{field}', this.getLabelText())
.replace('{otherField}', this.translate(field, 'fields', this.model.name));
.replace('{otherField}', this.translate(field, 'fields', this.model.entityType));
this.showValidationMessage(msg);
+5 -5
View File
@@ -221,7 +221,7 @@ class EmailFieldView extends VarcharFieldView {
let optOut;
if (this.model.isNew()) {
optOut = this.emailAddressOptedOutByDefault && this.model.name !== 'User';
optOut = this.emailAddressOptedOutByDefault && this.model.entityType !== 'User';
} else {
optOut = this.model.get(this.isOptedOutFieldName)
}
@@ -436,7 +436,7 @@ class EmailFieldView extends VarcharFieldView {
to: emailAddress
};
let scope = this.model.name;
let scope = this.model.entityType;
switch (scope) {
case 'Account':
@@ -469,8 +469,8 @@ class EmailFieldView extends VarcharFieldView {
}
if (!attributes.parentId) {
if (this.checkParentTypeAvailability(this.model.name)) {
attributes.parentType = this.model.name;
if (this.checkParentTypeAvailability(this.model.entityType)) {
attributes.parentType = this.model.entityType;
attributes.parentId = this.model.id;
attributes.parentName = this.model.get('name');
}
@@ -483,7 +483,7 @@ class EmailFieldView extends VarcharFieldView {
}
if (~['Contact', 'Lead', 'Account'].indexOf(this.model.name)) {
if (~['Contact', 'Lead', 'Account'].indexOf(this.model.entityType)) {
attributes.nameHash = {};
attributes.nameHash[emailAddress] = this.model.get('name');
}
+2 -2
View File
@@ -565,7 +565,7 @@ class FileFieldView extends LinkFieldView {
});
attachment.set('role', 'Attachment');
attachment.set('relatedType', this.model.name);
attachment.set('relatedType', this.model.entityType);
attachment.set('field', this.name);
this.handleUploadingFile(file).then(file => {
@@ -771,7 +771,7 @@ class FileFieldView extends LinkFieldView {
}
modelList.forEach(model => {
if (model.name === 'Attachment') {
if (model.entityType === 'Attachment') {
this.setAttachment(model);
return;
+2 -2
View File
@@ -80,7 +80,7 @@ define('views/fields/followers', ['views/fields/link-multiple'], function (Dep)
reloadFollowers: function () {
this.getCollectionFactory().create('User', (collection) => {
collection.url = this.model.name + '/' + this.model.id + '/followers';
collection.url = this.model.entityType + '/' + this.model.id + '/followers';
collection.offset = 0;
collection.maxSize = this.limit;
@@ -105,7 +105,7 @@ define('views/fields/followers', ['views/fields/link-multiple'], function (Dep)
showMoreFollowers: function () {
this.getCollectionFactory().create('User', (collection) => {
collection.url = this.model.name + '/' + this.model.id + '/followers';
collection.url = this.model.entityType + '/' + this.model.id + '/followers';
collection.offset = this.ids.length || 0;
collection.maxSize = this.portionSize;
collection.data.select = ['id', 'name'].join(',');
+1 -1
View File
@@ -42,7 +42,7 @@ define('views/fields/foreign-array', ['views/fields/array'], function (Dep) {
return;
}
let scope = this.getMetadata().get(['entityDefs', this.model.name, 'links', link, 'entity']);
let scope = this.getMetadata().get(['entityDefs', this.model.entityType, 'links', link, 'entity']);
if (!scope) {
return;
+1 -1
View File
@@ -40,7 +40,7 @@ define('views/fields/foreign-checklist', ['views/fields/checklist'], function (D
}
var scope = this.getMetadata()
.get(['entityDefs', this.model.name, 'links', this.params.link, 'entity']);
.get(['entityDefs', this.model.entityType, 'links', this.params.link, 'entity']);
if (!scope) {
return;
+1 -1
View File
@@ -42,7 +42,7 @@ define('views/fields/foreign-enum', ['views/fields/enum'], function (Dep) {
return;
}
let scope = this.getMetadata().get(['entityDefs', this.model.name, 'links', link, 'entity']);
let scope = this.getMetadata().get(['entityDefs', this.model.entityType, 'links', link, 'entity']);
if (!scope) {
return;
@@ -77,7 +77,7 @@ function (Dep, RegExpPattern, /** module:ui/select*/Select) {
});
let columns = this.getMetadata()
.get(['entityDefs', this.model.name, 'fields', this.name, 'columns']) || {};
.get(['entityDefs', this.model.entityType, 'fields', this.name, 'columns']) || {};
/** @type {string[]} */
this.columnList = this.columnList || Object.keys(columns);
@@ -99,9 +99,9 @@ function (Dep, RegExpPattern, /** module:ui/select*/Select) {
if (
!this.getMetadata().get(['entityDefs', this.foreignScope, 'fields', field, 'type']) &&
this.getMetadata().get(['entityDefs', this.model.name, 'fields', field, 'type'])
this.getMetadata().get(['entityDefs', this.model.entityType, 'fields', field, 'type'])
) {
o.scope = this.model.name;
o.scope = this.model.entityType;
}
let fieldDefs = this.getMetadata().get(['entityDefs', o.scope, 'fields', field]) || {};
@@ -95,12 +95,12 @@ function (Dep, /** module:ui/select*/Select) {
});
this.roleField = this.getMetadata()
.get(['entityDefs', this.model.name, 'fields', this.name, 'columns', this.columnName]);
.get(['entityDefs', this.model.entityType, 'fields', this.name, 'columns', this.columnName]);
this.displayRoleAsLabel = this.getMetadata()
.get(['entityDefs', this.model.entityType, 'fields', this.roleField, 'displayAsLabel']);
this.roleFieldScope = this.roleFieldIsForeign ? this.foreignScope : this.model.name;
this.roleFieldScope = this.roleFieldIsForeign ? this.foreignScope : this.model.entityType;
if (this.roleType === this.ROLE_TYPE_ENUM && !this.forceRoles) {
this.roleList = this.getMetadata()
+1 -1
View File
@@ -175,7 +175,7 @@ class PersonNameFieldView extends VarcharFieldView {
if (this.model.isRequired(name)) {
if (!this.model.get(name)) {
let msg = this.translate('fieldIsRequired', 'messages')
.replace('{field}', this.translate(name, 'fields', this.model.name));
.replace('{field}', this.translate(name, 'fields', this.model.entityType));
this.showValidationMessage(msg, '[data-name="'+name+'"]');
return true;
+2 -2
View File
@@ -216,7 +216,7 @@ class PhoneFieldView extends VarcharFieldView {
let optOut;
if (this.model.isNew()) {
optOut = this.phoneNumberOptedOutByDefault && this.model.name !== 'User';
optOut = this.phoneNumberOptedOutByDefault && this.model.entityType !== 'User';
} else {
optOut = this.model.get(this.isOptedOutFieldName)
}
@@ -411,7 +411,7 @@ class PhoneFieldView extends VarcharFieldView {
this.dataFieldName = this.name + 'Data';
this.defaultType = this.defaultType ||
this.getMetadata()
.get('entityDefs.' + this.model.name + '.fields.' + this.name + '.defaultType');
.get('entityDefs.' + this.model.entityType + '.fields.' + this.name + '.defaultType');
this.isOptedOutFieldName = this.name + 'IsOptedOut';
this.isInvalidFieldName = this.name + 'IsInvalid';
+1 -1
View File
@@ -642,7 +642,7 @@ class WysiwygFieldView extends TextFieldView {
attachment.set('relatedId', this.model.id);
}
attachment.set('relatedType', this.model.name);
attachment.set('relatedType', this.model.entityType);
attachment.set('file', e.target.result);
attachment.set('field', this.name);
+2 -2
View File
@@ -35,8 +35,8 @@ define('views/import/detail', ['views/detail'], function (Dep) {
return this.buildHeaderHtml([
$('<a>')
.attr('href', '#' + this.model.name + '/list')
.text(this.getLanguage().translate(this.model.name, 'scopeNamesPlural')),
.attr('href', '#' + this.model.entityType + '/list')
.text(this.getLanguage().translate(this.model.entityType, 'scopeNamesPlural')),
$('<span>')
.text(name)
]);
@@ -38,7 +38,7 @@ define('views/import/record/row-actions/duplicates', ['views/record/row-actions/
label: 'Set as Not Duplicate',
data: {
id: this.model.id,
type: this.model.name,
type: this.model.entityType,
},
});
+1 -1
View File
@@ -63,7 +63,7 @@ class MergeView extends MainView {
return this.buildHeaderHtml([
$('<a>')
.attr('href', '#' + this.models[0].entityType)
.text(this.getLanguage().translate(this.models[0].name, 'scopeNamesPlural')),
.text(this.getLanguage().translate(this.models[0].entityType, 'scopeNamesPlural')),
$('<span>')
.text(this.getLanguage().translate('Merge'))
]);
+1 -1
View File
@@ -141,7 +141,7 @@ class ComposeEmailModalView extends EditModalView {
}
createRecordView(model, callback) {
let viewName = this.getMetadata().get('clientDefs.' + model.name + '.recordViews.compose') ||
let viewName = this.getMetadata().get('clientDefs.' + model.entityType + '.recordViews.compose') ||
'views/email/record/compose';
let options = {
+3 -3
View File
@@ -379,8 +379,8 @@ class DetailModalView extends ModalView {
let viewName =
this.detailViewName ||
this.detailView ||
this.getMetadata().get(['clientDefs', model.name, 'recordViews', 'detailSmall']) ||
this.getMetadata().get(['clientDefs', model.name, 'recordViews', 'detailQuick']) ||
this.getMetadata().get(['clientDefs', model.entityType, 'recordViews', 'detailSmall']) ||
this.getMetadata().get(['clientDefs', model.entityType, 'recordViews', 'detailQuick']) ||
'views/record/detail-small';
let options = {
@@ -475,7 +475,7 @@ class DetailModalView extends ModalView {
this.indexOfRecord = indexOfRecord;
this.id = this.sourceModel.id;
this.scope = this.sourceModel.name;
this.scope = this.sourceModel.entityType;
this.model = this.sourceModel.clone();
this.model.collection = this.sourceModel.collection.clone();
+2 -2
View File
@@ -193,8 +193,8 @@ class EditModalView extends ModalView {
createRecordView(model, callback) {
let viewName =
this.editView ||
this.getMetadata().get(['clientDefs', model.name, 'recordViews', 'editSmall']) ||
this.getMetadata().get(['clientDefs', model.name, 'recordViews', 'editQuick']) ||
this.getMetadata().get(['clientDefs', model.entityType, 'recordViews', 'editSmall']) ||
this.getMetadata().get(['clientDefs', model.entityType, 'recordViews', 'editQuick']) ||
'views/record/edit-small';
let options = {
+1 -1
View File
@@ -51,7 +51,7 @@ class KanbanMoveOverModalView extends ModalView {
}
setup() {
this.scope = this.model.name;
this.scope = this.model.entityType;
let iconHtml = this.getHelper().getScopeColorIconHtml(this.scope);
@@ -60,7 +60,7 @@ define('views/personal-data/modals/personal-data', ['views/modal'], function (De
this.fieldList = [];
this.scope = this.model.name;
this.scope = this.model.entityType;
this.createView('record', 'views/personal-data/record/record', {
selector: '.record',
@@ -92,7 +92,7 @@ define('views/personal-data/record/record', ['views/record/base'], function (Dep
...this.events,
};
this.scope = this.model.name;
this.scope = this.model.entityType;
this.fieldList = [];
this.checkedFieldList = [];
-2
View File
@@ -596,8 +596,6 @@ class BaseRecordView extends View {
this.setIsNotChanged();
});
this.events = this.events || {};
this.entityType = this.model.entityType || this.model.name;
this.scope = this.options.scope || this.entityType;
+1 -1
View File
@@ -37,7 +37,7 @@ class DetailMiddleRecordView extends View {
init() {
this.recordHelper = this.options.recordHelper;
this.scope = this.model.name;
this.scope = this.model.entityType;
}
data() {
+1 -1
View File
@@ -77,7 +77,7 @@ class DetailSideRecordView extends PanelsContainerRecordView {
init() {
this.panelList = this.options.panelList || this.panelList;
this.scope = this.entityType = this.options.model.name;
this.scope = this.entityType = this.options.model.entityType;
this.recordHelper = this.options.recordHelper;
+10 -10
View File
@@ -1726,7 +1726,7 @@ class DetailRecordView extends BaseRecordView {
}
init() {
this.entityType = this.model.name;
this.entityType = this.model.entityType || this.model.name;
this.scope = this.options.scope || this.entityType;
this.layoutName = this.options.layoutName || this.layoutName;
@@ -1973,7 +1973,7 @@ class DetailRecordView extends BaseRecordView {
});
let dependencyDefs = Espo.Utils.clone(
this.getMetadata().get(['clientDefs', this.model.name, 'formDependency']) || {}
this.getMetadata().get(['clientDefs', this.entityType, 'formDependency']) || {}
);
this.dependencyDefs = _.extend(dependencyDefs, this.dependencyDefs);
@@ -1981,7 +1981,7 @@ class DetailRecordView extends BaseRecordView {
this.initDependancy();
let dynamicLogic = Espo.Utils.clone(
this.getMetadata().get(['clientDefs', this.model.name, 'dynamicLogic']) || {}
this.getMetadata().get(['clientDefs', this.entityType, 'dynamicLogic']) || {}
);
this.dynamicLogicDefs = _.extend(dynamicLogic, this.dynamicLogicDefs);
@@ -2239,7 +2239,7 @@ class DetailRecordView extends BaseRecordView {
}
let id = model.id;
let scope = model.name || this.scope;
let scope = this.entityType || this.scope;
let url;
@@ -2353,7 +2353,7 @@ class DetailRecordView extends BaseRecordView {
actionViewFollowers(data) {
let viewName = this.getMetadata().get(
['clientDefs', this.model.name, 'relationshipPanels', 'followers', 'viewModalView']
['clientDefs', this.entityType, 'relationshipPanels', 'followers', 'viewModalView']
) ||
this.getMetadata().get(['clientDefs', 'User', 'modalViews', 'relatedList']) ||
'views/modals/followers-list';
@@ -2369,7 +2369,7 @@ class DetailRecordView extends BaseRecordView {
scope: 'User',
title: this.translate('Followers'),
filtersDisabled: true,
url: this.model.entityType + '/' + this.model.id + '/followers',
url: this.entityType + '/' + this.model.id + '/followers',
createDisabled: true,
selectDisabled: selectDisabled,
rowActionsView: 'views/user/record/row-actions/relationship-followers',
@@ -2414,7 +2414,7 @@ class DetailRecordView extends BaseRecordView {
actionPrintPdf() {
this.createView('pdfTemplate', 'views/modals/select-template', {
entityType: this.model.name,
entityType: this.entityType,
}, (view) => {
view.render();
@@ -2423,8 +2423,8 @@ class DetailRecordView extends BaseRecordView {
window.open(
'?entryPoint=pdf&entityType=' +
this.model.name+'&entityId=' +
this.model.id+'&templateId=' + model.id, '_blank'
this.entityType + '&entityId=' +
this.model.id + '&templateId=' + model.id, '_blank'
);
});
});
@@ -3157,7 +3157,7 @@ class DetailRecordView extends BaseRecordView {
return;
}
this.getHelper().layoutManager.get(this.model.name, this.layoutName, detailLayout => {
this.getHelper().layoutManager.get(this.entityType, this.layoutName, detailLayout => {
if (typeof this.modifyDetailLayout === 'function') {
detailLayout = Espo.Utils.cloneDeep(detailLayout);
+1 -1
View File
@@ -118,7 +118,7 @@ class ListTreeRecordItemView extends View {
}
this.rootView = this.options.rootView;
this.scope = this.model.name;
this.scope = this.model.entityType;
this.isUnfolded = false;
+3 -3
View File
@@ -2717,7 +2717,7 @@ class ListRecordView extends View {
type: this._internalLayoutType,
layout: internalLayout
},
name: this.type + '-' + model.name,
name: this.type + '-' + model.entityType,
setViewBeforeCallback: this.options.skipBuildRows && !this.isRendered(),
}, callback);
}, model);
@@ -2948,7 +2948,7 @@ class ListRecordView extends View {
let scope = data.scope;
if (!scope && model) {
scope = model.name;
scope = model.entityType;
}
if (!scope) {
@@ -3009,7 +3009,7 @@ class ListRecordView extends View {
let scope = data.scope;
if (!scope && model) {
scope = model.name;
scope = model.entityType;
}
if (!scope) {
@@ -53,12 +53,12 @@ class DefaultSidePanelView extends SidePanelView {
this.fieldList = Espo.Utils.cloneDeep(this.fieldList);
this.hasComplexCreated =
!!this.getMetadata().get(['entityDefs', this.model.name, 'fields', 'createdAt']) &&
!!this.getMetadata().get(['entityDefs', this.model.name, 'fields', 'createdBy']);
!!this.getMetadata().get(['entityDefs', this.model.entityType, 'fields', 'createdAt']) &&
!!this.getMetadata().get(['entityDefs', this.model.entityType, 'fields', 'createdBy']);
this.hasComplexModified =
!!this.getMetadata().get(['entityDefs', this.model.name, 'fields', 'modifiedAt']) &&
!!this.getMetadata().get(['entityDefs', this.model.name, 'fields', 'modifiedBy']);
!!this.getMetadata().get(['entityDefs', this.model.entityType, 'fields', 'modifiedAt']) &&
!!this.getMetadata().get(['entityDefs', this.model.entityType, 'fields', 'modifiedBy']);
super.setup();
}
@@ -124,7 +124,7 @@ class DefaultSidePanelView extends SidePanelView {
});
}
if (this.getMetadata().get(['scopes', this.model.name ,'stream']) && !this.getUser().isPortal()) {
if (this.getMetadata().get(['scopes', this.model.entityType ,'stream']) && !this.getUser().isPortal()) {
this.fieldList.push({
name: 'followers',
labelText: this.translate('Followers'),
@@ -95,7 +95,7 @@ class RelationshipPanelView extends BottomPanelView {
this.link = this.link || this.defs.link || this.panelName;
if (!this.scope && !(this.link in this.model.defs.links)) {
throw new Error('Link \'' + this.link + '\' is not defined in model \'' + this.model.name + '\'');
throw new Error('Link \'' + this.link + '\' is not defined in model \'' + this.model.entityType + '\'');
}
this.scope = this.scope || this.model.defs.links[this.link].entity;
@@ -103,7 +103,7 @@ class RelationshipPanelView extends BottomPanelView {
let linkReadOnly = this.getMetadata()
.get(['entityDefs', this.model.entityType, 'links', this.link, 'readOnly']) || false;
let url = this.url = this.url || this.model.name + '/' + this.model.id + '/' + this.link;
let url = this.url = this.url || this.model.entityType + '/' + this.model.id + '/' + this.link;
if (!('create' in this.defs)) {
this.defs.create = true;
@@ -309,7 +309,7 @@ class RelationshipPanelView extends BottomPanelView {
* @protected
*/
setupTitle() {
this.title = this.title || this.translate(this.link, 'links', this.model.name);
this.title = this.title || this.translate(this.link, 'links', this.model.entityType);
var iconHtml = '';
@@ -427,7 +427,7 @@ class RelationshipPanelView extends BottomPanelView {
* @private
*/
getStoredFilter() {
var key = 'panelFilter' + this.model.name + '-' + (this.panelName || this.name);
var key = 'panelFilter' + this.model.entityType + '-' + (this.panelName || this.name);
return this.getStorage().get('state', key) || null;
}
@@ -436,7 +436,7 @@ class RelationshipPanelView extends BottomPanelView {
* @private
*/
storeFilter(filter) {
var key = 'panelFilter' + this.model.name + '-' + (this.panelName || this.name);
var key = 'panelFilter' + this.model.entityType + '-' + (this.panelName || this.name);
if (filter) {
this.getStorage().set('state', key, filter);
@@ -529,7 +529,7 @@ class RelationshipPanelView extends BottomPanelView {
actionViewRelatedList(data) {
var viewName =
this.getMetadata().get(
['clientDefs', this.model.name, 'relationshipPanels', this.name, 'viewModalView']
['clientDefs', this.model.entityType, 'relationshipPanels', this.name, 'viewModalView']
) ||
this.getMetadata().get(['clientDefs', this.scope, 'modalViews', 'relatedList']) ||
this.viewModalView ||
@@ -741,7 +741,7 @@ class RelationshipPanelView extends BottomPanelView {
Espo.Ui.notify(' ... ');
Espo.Ajax
.postRequest(this.model.name + '/action/unlinkAll', {
.postRequest(this.model.entityType + '/action/unlinkAll', {
link: data.link,
id: this.model.id,
})
@@ -37,7 +37,7 @@ define('views/record/row-actions/default-kanban', ['views/record/row-actions/def
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}];
if (this.options.statusFieldIsEditable) {
@@ -57,7 +57,7 @@ define('views/record/row-actions/default-kanban', ['views/record/row-actions/def
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
link: '#' + this.model.entityType + '/edit/' + this.model.id
});
}
@@ -75,7 +75,7 @@ class DefaultRowActionsView extends View {
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id,
link: '#' + this.model.entityType + '/view/' + this.model.id,
}];
if (this.options.acl.edit) {
@@ -85,7 +85,7 @@ class DefaultRowActionsView extends View {
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id,
link: '#' + this.model.entityType + '/edit/' + this.model.id,
});
}
@@ -106,7 +106,7 @@ class DefaultRowActionsView extends View {
return {
acl: this.options.acl,
actionList: this.getActionList(),
scope: this.model.name,
scope: this.model.entityType,
};
}
}
@@ -40,7 +40,7 @@ define('views/record/row-actions/edit-and-remove', ['views/record/row-actions/de
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
link: '#' + this.model.entityType + '/edit/' + this.model.id
});
}
@@ -37,7 +37,7 @@ define('views/record/row-actions/relationship-no-remove', ['views/record/row-act
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}];
if (this.options.acl.edit) {
@@ -47,7 +47,7 @@ define('views/record/row-actions/relationship-no-remove', ['views/record/row-act
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
link: '#' + this.model.entityType + '/edit/' + this.model.id
});
if (!this.options.unlinkDisabled) {
list.push({
@@ -37,7 +37,7 @@ define('views/record/row-actions/relationship-no-unlink', ['views/record/row-act
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}];
if (this.options.acl.edit) {
@@ -48,7 +48,7 @@ define('views/record/row-actions/relationship-no-unlink', ['views/record/row-act
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
link: '#' + this.model.entityType + '/edit/' + this.model.id
}
]);
}
@@ -65,6 +65,5 @@ define('views/record/row-actions/relationship-no-unlink', ['views/record/row-act
return list;
},
});
});
@@ -37,7 +37,7 @@ define('views/record/row-actions/relationship-view-and-edit', ['views/record/row
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}];
if (this.options.acl.edit) {
@@ -47,7 +47,7 @@ define('views/record/row-actions/relationship-view-and-edit', ['views/record/row
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
link: '#' + this.model.entityType + '/edit/' + this.model.id
});
}
@@ -37,7 +37,7 @@ define('views/record/row-actions/relationship-view-and-unlink', ['views/record/r
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}];
if (this.options.acl.edit && !this.options.unlinkDisabled) {
@@ -38,7 +38,7 @@ define('views/record/row-actions/relationship-view-only', ['views/record/row-act
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id,
link: '#' + this.model.entityType + '/view/' + this.model.id,
}
];
},
@@ -37,7 +37,7 @@ define('views/record/row-actions/relationship', ['views/record/row-actions/defau
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}];
if (this.options.acl.edit) {
@@ -47,7 +47,7 @@ define('views/record/row-actions/relationship', ['views/record/row-actions/defau
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
link: '#' + this.model.entityType + '/edit/' + this.model.id
});
if (!this.options.unlinkDisabled) {
@@ -37,7 +37,7 @@ define('views/record/row-actions/view-and-edit', ['views/record/row-actions/defa
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}];
if (this.options.acl.edit) {
@@ -48,7 +48,7 @@ define('views/record/row-actions/view-and-edit', ['views/record/row-actions/defa
data: {
id: this.model.id
},
link: '#' + this.model.name + '/edit/' + this.model.id
link: '#' + this.model.entityType + '/edit/' + this.model.id
}
]);
}
@@ -37,7 +37,7 @@ define('views/record/row-actions/view-and-remove', ['views/record/row-actions/de
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}];
if (this.options.acl.delete) {
@@ -38,7 +38,7 @@ define('views/record/row-actions/view-only', ['views/record/row-actions/default'
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}
];
},
+1 -1
View File
@@ -37,7 +37,7 @@ class FilterView extends View {
data() {
return {
name: this.name,
scope: this.model.name,
scope: this.model.entityType,
notRemovable: this.options.notRemovable,
};
}
@@ -36,6 +36,7 @@ define('views/settings/fields/address-preview', ['views/fields/address'], functi
var mainModel = this.model;
var model = mainModel.clone();
model.entityType = mainModel.entityType;
model.name = mainModel.name;
model.set({
+2 -2
View File
@@ -86,7 +86,7 @@ class NoteStreamView extends View {
if (!this.isUserStream) {
if (this.parentModel) {
if (
this.parentModel.name !== this.model.get('parentType') ||
this.parentModel.entityType !== this.model.get('parentType') ||
this.parentModel.id !== this.model.get('parentId')
) {
this.isThis = false;
@@ -223,7 +223,7 @@ class NoteStreamView extends View {
}
getIconHtml(scope, id) {
if (this.isThis && scope === this.parentModel.name) {
if (this.isThis && scope === this.parentModel.entityType) {
return;
}
@@ -55,7 +55,7 @@ define('views/stream/notes/email-received', ['views/stream/note'], function (Dep
if (
this.parentModel &&
(
this.model.get('parentType') === this.parentModel.name &&
this.model.get('parentType') === this.parentModel.entityType &&
this.model.get('parentId') === this.parentModel.id
)
) {
+1 -1
View File
@@ -53,7 +53,7 @@ define('views/stream/notes/email-sent', ['views/stream/note'], function (Dep) {
if (
this.parentModel &&
(
this.model.get('parentType') === this.parentModel.name &&
this.model.get('parentType') === this.parentModel.entityType &&
this.model.get('parentId') === this.parentModel.id
)
) {
+2 -2
View File
@@ -84,10 +84,10 @@ define('views/stream/notes/update', ['views/stream/note'], function (Dep) {
fields.forEach(field => {
let type = model.getFieldType(field) || 'base';
let viewName = this.getMetadata()
.get(['entityDefs', model.name, 'fields', field, 'view']) ||
.get(['entityDefs', model.entityType, 'fields', field, 'view']) ||
this.getFieldManager().getViewName(type);
let attributeList = this.getFieldManager().getEntityTypeFieldAttributeList(model.name, field);
let attributeList = this.getFieldManager().getEntityTypeFieldAttributeList(model.entityType, field);
let hasValue = false;
+7 -7
View File
@@ -184,7 +184,7 @@ class PanelStreamView extends RelationshipPanelView {
...this.events,
};
this.scope = this.model.name;
this.scope = this.model.entityType;
this.filter = this.getStoredFilter();
this.setupTitle();
@@ -198,9 +198,9 @@ class PanelStreamView extends RelationshipPanelView {
this.isInternalNoteMode = false;
this.storageTextKey = 'stream-post-' + this.model.name + '-' + this.model.id;
this.storageAttachmentsKey = 'stream-post-attachments-' + this.model.name + '-' + this.model.id;
this.storageIsInernalKey = 'stream-post-is-internal-' + this.model.name + '-' + this.model.id;
this.storageTextKey = 'stream-post-' + this.model.entityType + '-' + this.model.id;
this.storageAttachmentsKey = 'stream-post-attachments-' + this.model.entityType + '-' + this.model.id;
this.storageIsInernalKey = 'stream-post-is-internal-' + this.model.entityType + '-' + this.model.id;
this.on('remove', () => {
this.storeControl();
@@ -382,7 +382,7 @@ class PanelStreamView extends RelationshipPanelView {
this.getCollectionFactory().create('Note', (collection) => {
this.collection = collection;
collection.url = this.model.name + '/' + this.model.id + '/stream';
collection.url = this.model.entityType + '/' + this.model.id + '/stream';
collection.maxSize = this.getConfig().get('recordsPerPageSmall') || 5;
this.setFilter(this.filter);
@@ -615,7 +615,7 @@ class PanelStreamView extends RelationshipPanelView {
prepareNoteForPost(model) {
model.set('parentId', this.model.id);
model.set('parentType', this.model.name);
model.set('parentType', this.model.entityType);
}
getButtonList() {
@@ -667,7 +667,7 @@ class PanelStreamView extends RelationshipPanelView {
// noinspection JSUnusedGlobalSymbols
actionViewPostList() {
var url = this.model.name + '/' + this.model.id + '/posts';
var url = this.model.entityType + '/' + this.model.id + '/posts';
var data = {
scope: 'Note',
+1 -1
View File
@@ -144,7 +144,7 @@ class ListStreamRecordView extends ListExpandedRecordView {
isUserStream: this.options.isUserStream,
noEdit: this.options.noEdit,
optionsToPass: ['acl'],
name: this.type + '-' + model.name,
name: this.type + '-' + model.entityType,
selector: 'li[data-id="' + model.id + '"]',
setViewBeforeCallback: this.options.skipBuildRows && !this.isRendered(),
}, callback);
@@ -65,8 +65,7 @@ define('views/user-security/modals/two-factor-email',
let codeLength = this.getConfig().get('auth2FAEmailCodeLength') || 7;
let model = new Model();
model.name = 'UserSecurity';
model.entityType = model.name = 'UserSecurity';
model.set('emailAddress', null);
@@ -47,9 +47,8 @@ define('views/user/password-change-request', ['view', 'model'], function (Dep, M
},
setup: function () {
var model = this.model = new Model;
model.name = 'User';
let model = this.model = new Model();
model.entityType = model.name = 'User';
this.createView('password', 'views/user/fields/password', {
model: model,
+1 -1
View File
@@ -313,7 +313,7 @@ define('views/user/record/detail', ['views/record/detail'], function (Dep) {
getGridLayout: function (callback) {
this._helper
.layoutManager
.get(this.model.name, this.options.layoutName || this.layoutName, (simpleLayout) => {
.get(this.model.entityType, this.options.layoutName || this.layoutName, (simpleLayout) => {
var layout = Espo.Utils.cloneDeep(simpleLayout);
+12 -11
View File
@@ -162,32 +162,34 @@ define('views/user/record/edit', ['views/record/edit', 'views/user/record/detail
},
getGridLayout: function (callback) {
this._helper.layoutManager.get(this.model.name, this.options.layoutName || this.layoutName, function (simpleLayout) {
this._helper.layoutManager.get(this.model.entityType, this.options.layoutName || this.layoutName, simpleLayout => {
var layout = Espo.Utils.cloneDeep(simpleLayout);
layout.push({
"label": "Teams and Access Control",
"name": "accessControl",
"rows": [
[{"name":"type"}, {"name":"isActive"}],
[{"name":"teams"}, {"name":"defaultTeam"}],
[{"name":"roles"}, false]
[{"name": "type"}, {"name": "isActive"}],
[{"name": "teams"}, {"name": "defaultTeam"}],
[{"name": "roles"}, false]
]
});
layout.push({
"label": "Portal",
"name": "portal",
"rows": [
[{"name":"portals"}, {"name":"contact"}],
[{"name":"portalRoles"}, {"name":"accounts"}]
[{"name": "portals"}, {"name": "contact"}],
[{"name": "portalRoles"}, {"name": "accounts"}]
]
});
if (this.getUser().isAdmin() && this.model.isPortal()) {
layout.push({
"label": "Misc",
"name": "portalMisc",
"rows": [
[{"name":"dashboardTemplate"}, false]
[{"name": "dashboardTemplate"}, false]
]
});
}
@@ -202,7 +204,7 @@ define('views/user/record/edit', ['views/record/edit', 'views/user/record/detail
});
}
if (this.type == 'edit' && this.getUser().isAdmin() && !this.model.isApi()) {
if (this.type === 'edit' && this.getUser().isAdmin() && !this.model.isApi()) {
layout.push({
label: 'Password',
rows: [
@@ -259,7 +261,7 @@ define('views/user/record/edit', ['views/record/edit', 'views/user/record/detail
layout.push({
"name": "auth",
"rows": [
[{"name":"authMethod"}, false]
[{"name": "authMethod"}, false]
]
});
}
@@ -270,7 +272,7 @@ define('views/user/record/edit', ['views/record/edit', 'views/user/record/detail
};
callback(gridLayout);
}.bind(this));
});
},
getPasswordSendingMessage: function () {
@@ -305,6 +307,5 @@ define('views/user/record/edit', ['views/record/edit', 'views/user/record/detail
errorHandlerUserNameExists: function () {
Espo.Ui.error(this.translate('userNameExists', 'messages', 'User'))
},
});
});
@@ -37,7 +37,7 @@ define('views/user/record/row-actions/relationship-followers', ['views/record/ro
data: {
id: this.model.id
},
link: '#' + this.model.name + '/view/' + this.model.id
link: '#' + this.model.entityType + '/view/' + this.model.id
}];
if (