EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
ref
Yuri Kuznetsov85a98326fe9f
diff --git a/client/src/views/fields/link.js b/client/src/views/fields/link.jsindex 8f57e7fa60..35ac7e35b0 100644--- a/client/src/views/fields/link.js+++ b/client/src/views/fields/link.js@@ -1133,13 +1133,9 @@ class LinkFieldView extends BaseFieldView {/*** @protected*/- actionSelect() {- Espo.Ui.notifyWait();-- const panelDefs = this.panelDefs;-- const viewName = panelDefs.selectModalView ||- this.getMetadata().get(['clientDefs', this.foreignScope, 'modalViews', 'select']) ||+ async actionSelect() {+ const viewName = this.panelDefs.selectModalView ||+ this.getMetadata().get(`clientDefs.${this.foreignScope}.modalViews.select`) ||this.selectRecordsView;const mandatorySelectAttributeList = this.getMandatorySelectAttributeList();@@ -1147,38 +1143,45 @@ class LinkFieldView extends BaseFieldView {const createButton = this.isEditMode() && (!this.createDisabled || this.forceCreateButton);const createAttributesProvider = createButton ?- this.getCreateAttributesProvider() :- null;-- this._getSelectFilters().then(filters => {- const orderBy = filters.orderBy || this.panelDefs.selectOrderBy;- const orderDirection = filters.orderBy ? filters.order : this.panelDefs.selectOrderDirection;-- this.createView('dialog', viewName, {- scope: this.foreignScope,- createButton: createButton,- filters: filters.advanced,- boolFilterList: filters.bool,- primaryFilterName: filters.primary,- mandatorySelectAttributeList: mandatorySelectAttributeList,- forceSelectAllAttributes: this.forceSelectAllAttributes,- filterList: this.getSelectFilterList(),- createAttributesProvider: createAttributesProvider,- layoutName: this.panelDefs.selectLayout,- orderBy: orderBy,- orderDirection: orderDirection,- }, view => {- view.render();-- Espo.Ui.notify(false);-- this.listenToOnce(view, 'select', model => {- this.clearView('dialog');-- this.select(model);- });- });- });+ this.getCreateAttributesProvider() : null;++ Espo.Ui.notifyWait();++ const filters = await this._getSelectFilters();++ const orderBy = filters.orderBy || this.panelDefs.selectOrderBy;+ const orderDirection = filters.orderBy ? filters.order : this.panelDefs.selectOrderDirection;++ /** @type {import('views/modal').default} */+ let view;++ /** @type {module:views/modals/select-records~Options} */+ const options = {+ entityType: this.foreignScope,+ createButton: createButton,+ filters: filters.advanced,+ boolFilterList: filters.bool,+ primaryFilterName: filters.primary,+ mandatorySelectAttributeList: mandatorySelectAttributeList,+ forceSelectAllAttributes: this.forceSelectAllAttributes,+ filterList: this.getSelectFilterList(),+ createAttributesProvider: createAttributesProvider,+ layoutName: this.panelDefs.selectLayout,+ orderBy: orderBy,+ orderDirection: orderDirection,+ onSelect: (models) => {+ view.close();++ this.select(models[0]);+ },+ };++ view = /** @type {import('views/modal').default} */+ await this.createView('modal', viewName, options);++ await view.render();++ Espo.Ui.notify();}/**diff --git a/client/src/views/modals/select-records.js b/client/src/views/modals/select-records.jsindex 71f8679d46..70338f36cd 100644--- a/client/src/views/modals/select-records.js+++ b/client/src/views/modals/select-records.js@@ -89,7 +89,7 @@ class SelectRecordsModalView extends ModalView {* @property {Object.<string, module:search-manager~advancedFilter>} [filters] Filters.* @property {string[]} [boolFilterList] Bool filters.* @property {string} [primaryFilterName] A primary filter.- * @property {string} [filterList] A filter list.+ * @property {string[]} [filterList] A filter list.* @property {string} [layoutName] A layout name.* @property {boolean} [multiple] Allow select multiple.* @property {boolean} [createButton] A create button.