From 61402f9848744cdc9d9754e6004f8b85cce7358a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 24 Jul 2025 10:00:42 +0200 Subject: [PATCH] Bug 40483: Restore search vendors by alias Prior to bug 38010 we were able to search vendors by alias. This patch restores it by moving the filter to kohaTable's "default_filters" to allow to pass a more complex condition Test plan: Create several vendors, some with aliases Confirm that searching by alias return the vendors Confirm that refining the search (using the table's global search) works as expected --- .../prog/js/vue/components/Vendors/VendorList.vue | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue index b689f10db09..60ac704af03 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorList.vue @@ -64,7 +64,6 @@ export default { fp_config: flatpickr_defaults, vendor_count: 0, initialized: false, - searchTerm: null, tableOptions: { columns: this.getTableColumns(), options: { @@ -73,6 +72,7 @@ export default { url: () => this.tableURL(), table_settings: this.vendorTableSettings, add_filters: true, + default_filters: {}, filters_options: { 1: [ { _id: 0, _str: this.$__("Inactive") }, @@ -118,8 +118,14 @@ export default { beforeRouteEnter(to, from, next) { next(vm => { vm.getVendorCount().then(() => (vm.initialized = true)); - if (to.query.supplier) { - vm.searchTerm = to.query.supplier; + const searchTerm = to.query.supplier; + if (searchTerm) { + vm.tableOptions.default_filters = { + "-and": [ + { "me.name": { like: `%${searchTerm}%` } }, + { "aliases.alias": { like: `%${searchTerm}%` } }, + ], + }; } }); }, @@ -183,9 +189,6 @@ export default { }, tableURL() { let url = "/api/v1/acquisitions/vendors"; - if (this.searchTerm) { - url += "?name=" + this.searchTerm; - } return url; }, getTableColumns() { -- 2.34.1