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
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 3f5953f23d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
parent
e650b3e5ef
commit
52465feb11
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue