From 76353b2e885a081262550a86684d583927b49cb6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 31 Jul 2025 15:40:40 +0200 Subject: [PATCH] Bug 38311: Do not use ID for column filters --- .../tables/items/catalogue_detail.inc | 26 +++---- .../prog/en/includes/patron-search.inc | 71 ++++++++++--------- .../prog/en/modules/catalogue/itemsearch.tt | 35 +++++---- .../prog/en/modules/circ/pendingbookings.tt | 5 +- .../prog/en/modules/circ/pendingreserves.tt | 27 +++++-- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 19 +++-- 6 files changed, 102 insertions(+), 81 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index fdbfec2cef3..04509626bb9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -205,15 +205,13 @@ }); }); - const all_libraries = [% To.json(Branches.all) | $raw %]; - const libraries_filters = all_libraries.map(e => { + const all_libraries = [% To.json(Branches.all) | $raw %].map(e => { e["_id"] = e["branchcode"]; e["_str"] = e["branchname"]; return e; }); const libraries_names = new Map(all_libraries.map( l => [l.branchcode, l.branchname] )); - const all_item_types = [% To.json(ItemTypes.Get) | $raw %]; - const item_types_filters = all_item_types.map(e => { + const all_item_types = [% To.json(ItemTypes.Get) | $raw %].map(e => { e["_id"] = e["itemtype"]; e["_str"] = e["translated_description"]; return e; @@ -241,6 +239,13 @@ collection_code: new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.ccode' })) | $raw %].map( av => [av.lib, av.authorised_value])), }; + let filters_options = { + item_types: all_item_types, + libraries: all_libraries, + libraries: all_libraries, + statuses: all_statuses, + }; + [% IF Koha.Preference('URLLinkText') %] const url_link_text = "[% Koha.Preference('URLLinkText') | html %]"; [% ELSE %] @@ -326,15 +331,6 @@ return $("#" + tab_id + "_status select").val(); }; - let offset = 2; - [% UNLESS Koha.Preference('LocalCoverImages') %]offset--;[% END %] - let filters_options = { - [offset] : () => all_item_types, - [offset+1] : () => all_libraries, - [offset+2] : () => all_libraries, - [offset+7] : () => all_statuses, - }; - var items_table = $("#" + tab_id + '_table').kohaTable({ ajax: { url: item_table_url }, order: [], @@ -387,6 +383,7 @@ { data: "me.item_type_id", // FIXME Cannot filter by biblioitem.itemtype datatype: "coded_value:item_type", + dataFilter: "item_types", className: "itype", searchable: true, orderable: true, @@ -407,6 +404,7 @@ { data: "me.holding_library_id", datatype: "coded_value:library", + dataFilter: "libraries", className: "location", searchable: true, orderable: true, @@ -417,6 +415,7 @@ { data: "me.home_library_id", datatype: "coded_value:library", + dataFilter: "libraries", className: "homebranch", searchable: true, orderable: true, @@ -507,6 +506,7 @@ { data: "", className: "status", + dataFilter: "statuses", searchable: false, orderable: false, render: function (data, type, row, meta) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc index 85184bdc6aa..a53b8653c0d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -175,9 +175,9 @@ [% CASE 'address-library' %] Address [% CASE 'branch' %] - Library + Library [% CASE 'category' %] - Category + Category [% CASE 'dateexpiry' %] Expires on [% CASE 'borrowernotes' %] @@ -189,17 +189,9 @@ [% CASE 'account_balance' %] Fines [% CASE 'sort1' %] - [% IF av_bsort1.size %] - Sort 1 - [% ELSE %] - Sort 1 - [% END %] + Sort 1 [% CASE 'sort2' %] - [% IF av_bsort2.size %] - Sort 2 - [% ELSE %] - Sort 2 - [% END %] + Sort 2 [% CASE 'action' %]   [% END %] @@ -244,9 +236,7 @@ [% END %]