link link multiple search data naming
This commit is contained in:
@@ -35,9 +35,12 @@ Espo.define('crm:views/case/fields/contact', 'views/fields/link', function (Dep)
|
||||
return {
|
||||
'account': {
|
||||
type: 'equals',
|
||||
field: 'accountId',
|
||||
attribute: 'accountId',
|
||||
value: this.model.get('accountId'),
|
||||
valueName: this.model.get('accountName'),
|
||||
data: {
|
||||
type: 'is',
|
||||
nameValue: this.model.get('accountName')
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -37,9 +37,12 @@ Espo.define('crm:views/case/fields/contacts', 'views/fields/link-multiple-with-p
|
||||
return {
|
||||
'account': {
|
||||
type: 'equals',
|
||||
field: 'accountId',
|
||||
attribute: 'accountId',
|
||||
value: this.model.get('accountId'),
|
||||
valueName: this.model.get('accountName')
|
||||
data: {
|
||||
type: 'is',
|
||||
nameValue: this.model.get('accountName')
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -48,10 +48,13 @@ Espo.define('crm:views/contact/detail', 'views/detail', function (Dep) {
|
||||
'account': function () {
|
||||
if (this.model.get('accountId')) {
|
||||
return {
|
||||
field: 'accountId',
|
||||
attribute: 'accountId',
|
||||
type: 'equals',
|
||||
value: this.model.get('accountId'),
|
||||
valueName: this.model.get('accountName')
|
||||
data: {
|
||||
type: 'is',
|
||||
nameValue: this.model.get('accountName')
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -60,10 +63,13 @@ Espo.define('crm:views/contact/detail', 'views/detail', function (Dep) {
|
||||
'account': function () {
|
||||
if (this.model.get('accountId')) {
|
||||
return {
|
||||
field: 'accountId',
|
||||
attribute: 'accountId',
|
||||
type: 'equals',
|
||||
value: this.model.get('accountId'),
|
||||
valueName: this.model.get('accountName')
|
||||
data: {
|
||||
type: 'is',
|
||||
nameValue: this.model.get('accountName')
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -72,4 +78,3 @@ Espo.define('crm:views/contact/detail', 'views/detail', function (Dep) {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -35,9 +35,12 @@ Espo.define('crm:views/lead/fields/created-contact', 'views/fields/link', functi
|
||||
return {
|
||||
'account': {
|
||||
type: 'equals',
|
||||
field: 'accountId',
|
||||
attribute: 'accountId',
|
||||
value: this.model.get('createdAccountId'),
|
||||
valueName: this.model.get('createdAccountName')
|
||||
data: {
|
||||
type: 'is',
|
||||
nameValue: this.model.get('createdAccountName')
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,9 +35,12 @@ Espo.define('crm:views/lead/fields/created-opportunity', 'views/fields/link', fu
|
||||
return {
|
||||
'account': {
|
||||
type: 'equals',
|
||||
field: 'accountId',
|
||||
attribute: 'accountId',
|
||||
value: this.model.get('createdAccountId'),
|
||||
valueName: this.model.get('createdAccountName')
|
||||
data: {
|
||||
type: 'is',
|
||||
nameValue: this.model.get('createdAccountName')
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,9 +35,12 @@ Espo.define('crm:views/meeting/fields/contacts', 'crm:views/meeting/fields/atten
|
||||
return {
|
||||
'account': {
|
||||
type: 'equals',
|
||||
field: 'accountId',
|
||||
attribute: 'accountId',
|
||||
value: this.model.get('parentId'),
|
||||
valueName: this.model.get('parentName'),
|
||||
data: {
|
||||
type: 'is',
|
||||
nameValue: this.model.get('parentName')
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -52,10 +52,13 @@ Espo.define('crm:views/opportunity/detail', 'views/detail', function (Dep) {
|
||||
'account': function () {
|
||||
if (this.model.get('accountId')) {
|
||||
return {
|
||||
field: 'accountId',
|
||||
attribute: 'accountId',
|
||||
type: 'equals',
|
||||
value: this.model.get('accountId'),
|
||||
valueName: this.model.get('accountName')
|
||||
data: {
|
||||
type: 'is',
|
||||
nameValue: this.model.get('accountName')
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
@@ -70,14 +73,14 @@ Espo.define('crm:views/opportunity/detail', 'views/detail', function (Dep) {
|
||||
field: 'accounts',
|
||||
type: 'linkedWith',
|
||||
value: [accountId],
|
||||
nameHash: nameHash
|
||||
data: {
|
||||
nameHash: nameHash
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -35,9 +35,12 @@ Espo.define('crm:views/opportunity/fields/contacts', 'views/fields/link-multiple
|
||||
return {
|
||||
'account': {
|
||||
type: 'equals',
|
||||
field: 'accountId',
|
||||
attribute: 'accountId',
|
||||
value: this.model.get('accountId'),
|
||||
valueName: this.model.get('accountName'),
|
||||
data: {
|
||||
type: 'is',
|
||||
nameValue: this.model.get('accountName')
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,9 +39,12 @@ Espo.define('views/email-account/fields/email-folder', 'views/fields/link', func
|
||||
return {
|
||||
assignedUser: {
|
||||
type: 'equals',
|
||||
field: 'assignedUserId',
|
||||
attribute: 'assignedUserId',
|
||||
value: this.model.get('assignedUserId'),
|
||||
valueName: this.model.get('assignedUserName')
|
||||
data: {
|
||||
type: 'is',
|
||||
nameValue: this.model.get('assignedUserName')
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,9 +39,11 @@ Espo.define('views/email-filter/fields/email-folder', 'views/fields/link', funct
|
||||
return {
|
||||
assignedUser: {
|
||||
type: 'equals',
|
||||
field: 'assignedUserId',
|
||||
attribute: 'assignedUserId',
|
||||
value: this.model.get('parentId'),
|
||||
valueName: this.model.get('parentName')
|
||||
data: {
|
||||
nameValue: this.model.get('parentName')
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -96,12 +96,14 @@ Espo.define('views/fields/link-multiple', 'views/fields/base', function (Dep) {
|
||||
|
||||
var self = this;
|
||||
|
||||
this.ids = Espo.Utils.clone(this.model.get(this.idsName) || []);
|
||||
this.nameHash = Espo.Utils.clone(this.model.get(this.nameHashName) || {});
|
||||
|
||||
if (this.mode == 'search') {
|
||||
this.nameHash = Espo.Utils.clone(this.searchParams.nameHash) || {};
|
||||
this.ids = Espo.Utils.clone(this.searchParams.value) || [];
|
||||
var nameHash = this.getSearchParamsData().nameHash || this.searchParams.nameHash || {};
|
||||
var idList = this.getSearchParamsData().idList || this.searchParams.value || [];
|
||||
this.nameHash = Espo.Utils.clone(nameHash);
|
||||
this.ids = Espo.Utils.clone(idList);
|
||||
} else {
|
||||
this.ids = Espo.Utils.clone(this.model.get(this.idsName) || []);
|
||||
this.nameHash = Espo.Utils.clone(this.model.get(this.nameHashName) || {});
|
||||
}
|
||||
|
||||
this.listenTo(this.model, 'change:' + this.idsName, function () {
|
||||
|
||||
@@ -185,10 +185,13 @@ Espo.define('views/fields/link', 'views/fields/base', function (Dep) {
|
||||
},
|
||||
|
||||
setupSearch: function () {
|
||||
this.searchData.oneOfIdList = this.searchParams.oneOfIdList || [];
|
||||
this.searchData.oneOfNameHash = this.searchParams.oneOfNameHash || {};
|
||||
this.searchData.idValue = this.getSearchParamsData().idValue || this.searchParams.idValue || this.searchParams.value;
|
||||
this.searchData.nameValue = this.getSearchParamsData().nameValue || this.searchParams.valueName;
|
||||
this.searchData.oneOfIdList = this.getSearchParamsData().oneOfIdList || this.searchParams.oneOfIdList || [];
|
||||
this.searchData.oneOfNameHash = this.getSearchParamsData().oneOfNameHash || this.searchParams.oneOfNameHash || {};
|
||||
|
||||
if (~['is', 'isNot', 'equals'].indexOf(this.getSearchType())) {
|
||||
this.searchData.idValue = this.getSearchParamsData().idValue || this.searchParams.idValue || this.searchParams.value;
|
||||
this.searchData.nameValue = this.getSearchParamsData().nameValue || this.searchParams.nameValue || this.searchParams.valueName;
|
||||
}
|
||||
|
||||
this.events = _.extend({
|
||||
'change select.search-type': function (e) {
|
||||
@@ -420,7 +423,7 @@ Espo.define('views/fields/link', 'views/fields/base', function (Dep) {
|
||||
if (type == 'isEmpty') {
|
||||
var data = {
|
||||
type: 'isNull',
|
||||
field: this.idName,
|
||||
attribute: this.idName,
|
||||
data: {
|
||||
type: type
|
||||
}
|
||||
@@ -429,7 +432,7 @@ Espo.define('views/fields/link', 'views/fields/base', function (Dep) {
|
||||
} else if (type == 'isNotEmpty') {
|
||||
var data = {
|
||||
type: 'isNotNull',
|
||||
field: this.idName,
|
||||
attribute: this.idName,
|
||||
data: {
|
||||
type: type
|
||||
}
|
||||
@@ -438,12 +441,12 @@ Espo.define('views/fields/link', 'views/fields/base', function (Dep) {
|
||||
} else if (type == 'isOneOf') {
|
||||
var data = {
|
||||
type: 'in',
|
||||
field: this.idName,
|
||||
attribute: this.idName,
|
||||
value: this.searchData.oneOfIdList,
|
||||
oneOfIdList: this.searchData.oneOfIdList,
|
||||
oneOfNameHash: this.searchData.oneOfNameHash,
|
||||
data: {
|
||||
type: type
|
||||
type: type,
|
||||
oneOfIdList: this.searchData.oneOfIdList,
|
||||
oneOfNameHash: this.searchData.oneOfNameHash
|
||||
}
|
||||
};
|
||||
return data;
|
||||
@@ -461,23 +464,22 @@ Espo.define('views/fields/link', 'views/fields/base', function (Dep) {
|
||||
attribute: this.idName
|
||||
}
|
||||
],
|
||||
field: this.idName,
|
||||
oneOfIdList: this.searchData.oneOfIdList,
|
||||
oneOfNameHash: this.searchData.oneOfNameHash,
|
||||
data: {
|
||||
type: type
|
||||
type: type,
|
||||
oneOfIdList: this.searchData.oneOfIdList,
|
||||
oneOfNameHash: this.searchData.oneOfNameHash
|
||||
}
|
||||
};
|
||||
return data;
|
||||
} else if (type == 'isNotOneOfAndIsNotEmpty') {
|
||||
var data = {
|
||||
type: 'notIn',
|
||||
field: this.idName,
|
||||
attribute: this.idName,
|
||||
value: this.searchData.oneOfIdList,
|
||||
oneOfIdList: this.searchData.oneOfIdList,
|
||||
oneOfNameHash: this.searchData.oneOfNameHash,
|
||||
data: {
|
||||
type: type
|
||||
type: type,
|
||||
oneOfIdList: this.searchData.oneOfIdList,
|
||||
oneOfNameHash: this.searchData.oneOfNameHash
|
||||
}
|
||||
};
|
||||
return data;
|
||||
@@ -499,7 +501,6 @@ Espo.define('views/fields/link', 'views/fields/base', function (Dep) {
|
||||
attribute: this.idName
|
||||
}
|
||||
],
|
||||
field: this.idName,
|
||||
data: {
|
||||
type: type,
|
||||
idValue: value,
|
||||
@@ -514,7 +515,7 @@ Espo.define('views/fields/link', 'views/fields/base', function (Dep) {
|
||||
var nameValue = this.$el.find('[name="' + this.nameName + '"]').val();
|
||||
var data = {
|
||||
type: 'notEquals',
|
||||
field: this.idName,
|
||||
attribute: this.idName,
|
||||
value: value,
|
||||
data: {
|
||||
type: type,
|
||||
@@ -530,7 +531,7 @@ Espo.define('views/fields/link', 'views/fields/base', function (Dep) {
|
||||
var nameValue = this.$el.find('[name="' + this.nameName + '"]').val();
|
||||
var data = {
|
||||
type: 'equals',
|
||||
field: this.idName,
|
||||
attribute: this.idName,
|
||||
value: value,
|
||||
data: {
|
||||
type: type,
|
||||
@@ -548,4 +549,3 @@ Espo.define('views/fields/link', 'views/fields/base', function (Dep) {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user