link fields filters fix
This commit is contained in:
@@ -33,19 +33,10 @@ Espo.define('Views.Fields.AssignedUser', 'Views.Fields.UserWithAvatar', function
|
||||
|
||||
getSelectBoolFilterList: function () {
|
||||
if (this.assignmentPermission == 'team') {
|
||||
return {'onlyMyTeam': true};
|
||||
return ['onlyMyTeam'];
|
||||
}
|
||||
},
|
||||
|
||||
getAutocompleteUrl: function () {
|
||||
var url = Dep.prototype.getAutocompleteUrl.call(this);
|
||||
if (this.assignmentPermission == 'team') {
|
||||
url += '&where%5B0%5D%5Btype%5D=bool&where%5B0%5D%5Bvalue%5D%5B%5D=onlyMyTeam';
|
||||
}
|
||||
|
||||
return url;
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ Espo.define('Views.Fields.LinkMultiple', 'Views.Fields.Base', function (Dep) {
|
||||
|
||||
getSelectBoolFilterList: function () {},
|
||||
|
||||
getPrimaryFilterName: function () {},
|
||||
getSelectPrimaryFilterName: function () {},
|
||||
|
||||
setup: function () {
|
||||
this.nameHashName = this.name + 'Names';
|
||||
@@ -94,7 +94,7 @@ Espo.define('Views.Fields.LinkMultiple', 'Views.Fields.Base', function (Dep) {
|
||||
createButton: this.mode != 'search',
|
||||
filters: this.getSelectFilters(),
|
||||
boolFilterList: this.getSelectBoolFilterList(),
|
||||
primaryFilterName: this.getPrimaryFilterName(),
|
||||
primaryFilterName: this.getSelectPrimaryFilterName(),
|
||||
multiple: true
|
||||
}, function (dialog) {
|
||||
dialog.render();
|
||||
@@ -118,7 +118,18 @@ Espo.define('Views.Fields.LinkMultiple', 'Views.Fields.Base', function (Dep) {
|
||||
},
|
||||
|
||||
getAutocompleteUrl: function () {
|
||||
return this.foreignScope + '?sortBy=name&maxCount=' + this.AUTOCOMPLETE_RESULT_MAX_COUNT;
|
||||
var url = this.foreignScope + '?sortBy=name&maxCount=' + this.AUTOCOMPLETE_RESULT_MAX_COUNT;
|
||||
var boolList = this.getSelectBoolFilterList();
|
||||
if (boolList) {
|
||||
boolList.forEach(function(item) {
|
||||
url += '&where%5B0%5D%5Btype%5D=bool&where%5B0%5D%5Bvalue%5D%5B%5D=' + item;
|
||||
}, this);
|
||||
}
|
||||
var primary = this.getSelectPrimaryFilterName();
|
||||
if (primary) {
|
||||
url += '&where%5B0%5D%5Btype%5D=primary&where%5B0%5D%5Bvalue%5D=' + primary;
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
afterRender: function () {
|
||||
|
||||
@@ -60,7 +60,7 @@ Espo.define('Views.Fields.LinkParent', 'Views.Fields.Base', function (Dep) {
|
||||
|
||||
getSelectBoolFilterList: function () {},
|
||||
|
||||
getPrimaryFilterName: function () {},
|
||||
getSelectPrimaryFilterName: function () {},
|
||||
|
||||
setup: function () {
|
||||
this.nameName = this.name + 'Name';
|
||||
@@ -90,7 +90,7 @@ Espo.define('Views.Fields.LinkParent', 'Views.Fields.Base', function (Dep) {
|
||||
createButton: this.mode != 'search',
|
||||
filters: this.getSelectFilters(),
|
||||
boolFilterList: this.getSelectBoolFilterList(),
|
||||
primaryFilterName: this.getPrimaryFilterName(),
|
||||
primaryFilterName: this.getSelectPrimaryFilterName(),
|
||||
}, function (dialog) {
|
||||
dialog.render();
|
||||
Espo.Ui.notify(false);
|
||||
@@ -116,7 +116,18 @@ Espo.define('Views.Fields.LinkParent', 'Views.Fields.Base', function (Dep) {
|
||||
},
|
||||
|
||||
getAutocompleteUrl: function () {
|
||||
return this.foreignScope + '?sortBy=name&maxCount=' + this.AUTOCOMPLETE_RESULT_MAX_COUNT;
|
||||
var url = this.foreignScope + '?sortBy=name&maxCount=' + this.AUTOCOMPLETE_RESULT_MAX_COUNT;
|
||||
var boolList = this.getSelectBoolFilterList();
|
||||
if (boolList) {
|
||||
boolList.forEach(function(item) {
|
||||
url += '&where%5B0%5D%5Btype%5D=bool&where%5B0%5D%5Bvalue%5D%5B%5D=' + item;
|
||||
}, this);
|
||||
}
|
||||
var primary = this.getSelectPrimaryFilterName();
|
||||
if (primary) {
|
||||
url += '&where%5B0%5D%5Btype%5D=primary&where%5B0%5D%5Bvalue%5D=' + primary;
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
afterRender: function () {
|
||||
|
||||
@@ -59,7 +59,7 @@ Espo.define('Views.Fields.Link', 'Views.Fields.Base', function (Dep) {
|
||||
|
||||
getSelectBoolFilterList: function () {},
|
||||
|
||||
getPrimaryFilterName: function () {},
|
||||
getSelectPrimaryFilterName: function () {},
|
||||
|
||||
setup: function () {
|
||||
this.nameName = this.name + 'Name';
|
||||
@@ -79,7 +79,7 @@ Espo.define('Views.Fields.Link', 'Views.Fields.Base', function (Dep) {
|
||||
createButton: this.mode != 'search',
|
||||
filters: this.getSelectFilters(),
|
||||
boolFilterList: this.getSelectBoolFilterList(),
|
||||
primaryFilterName: this.getPrimaryFilterName()
|
||||
primaryFilterName: this.getSelectPrimaryFilterName()
|
||||
}, function (view) {
|
||||
view.render();
|
||||
this.notify(false);
|
||||
@@ -125,7 +125,18 @@ Espo.define('Views.Fields.Link', 'Views.Fields.Base', function (Dep) {
|
||||
},
|
||||
|
||||
getAutocompleteUrl: function () {
|
||||
return this.foreignScope + '?sortBy=name&maxCount=' + this.AUTOCOMPLETE_RESULT_MAX_COUNT;
|
||||
var url = this.foreignScope + '?sortBy=name&maxCount=' + this.AUTOCOMPLETE_RESULT_MAX_COUNT;
|
||||
var boolList = this.getSelectBoolFilterList();
|
||||
if (boolList) {
|
||||
boolList.forEach(function(item) {
|
||||
url += '&where%5B0%5D%5Btype%5D=bool&where%5B0%5D%5Bvalue%5D%5B%5D=' + item;
|
||||
}, this);
|
||||
}
|
||||
var primary = this.getSelectPrimaryFilterName();
|
||||
if (primary) {
|
||||
url += '&where%5B0%5D%5Btype%5D=primary&where%5B0%5D%5Bvalue%5D=' + primary;
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
afterRender: function () {
|
||||
|
||||
@@ -30,21 +30,10 @@ Espo.define('Views.Fields.Teams', 'Views.Fields.LinkMultiple', function (Dep) {
|
||||
|
||||
getSelectBoolFilterList: function () {
|
||||
if (this.assignmentPermission == 'team' || this.assignmentPermission == 'no') {
|
||||
return {'onlyMy': true};
|
||||
return ['onlyMy'];
|
||||
}
|
||||
},
|
||||
|
||||
getAutocompleteUrl: function () {
|
||||
var url = Dep.prototype.getAutocompleteUrl.call(this);
|
||||
if (this.assignmentPermission == 'team' || this.assignmentPermission == 'no') {
|
||||
url += '&where%5B0%5D%5Btype%5D=bool&where%5B0%5D%5Bvalue%5D%5B%5D=onlyMy';
|
||||
}
|
||||
|
||||
return url;
|
||||
},
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ Espo.define('Views.Modals.SelectRecords', 'Views.Modal', function (Dep) {
|
||||
|
||||
setup: function () {
|
||||
this.filters = this.options.filters || {};
|
||||
this.boolFilterList = this.options.boolFilterList || {};
|
||||
this.boolFilterList = this.options.boolFilterList || [];
|
||||
this.primaryFilterName = this.options.primaryFilterName || null;
|
||||
|
||||
if ('multiple' in this.options) {
|
||||
@@ -122,7 +122,11 @@ Espo.define('Views.Modals.SelectRecords', 'Views.Modal', function (Dep) {
|
||||
searchManager.setAdvanced(this.filters);
|
||||
}
|
||||
if (this.boolFilterList) {
|
||||
searchManager.setBool(this.boolFilterList);
|
||||
var d = {};
|
||||
this.boolFilterList.forEach(function (item) {
|
||||
d[item] = true;
|
||||
});
|
||||
searchManager.setBool(d);
|
||||
}
|
||||
if (this.primaryFilterName) {
|
||||
searchManager.setPrimary(this.primaryFilterName);
|
||||
|
||||
Reference in New Issue
Block a user