From 8a0c52aae62bc09d3bd9b65f46722fa072f01060 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 22 May 2023 10:49:08 +0000 Subject: [PATCH] Bug 33786: ILL requests table id Make sure requests table is unique when visiting patron ILL history so the table state is not shared unintentionally Signed-off-by: Martin Renvoize --- .../prog/en/includes/ill-list-table.inc | 4 ++++ .../intranet-tmpl/prog/js/ill-list-table.js | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc index c0d75cc27b..910f3a4f2a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc @@ -1,4 +1,8 @@ +[% IF patron.borrowernumber %] + +[% ELSE %]
+[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js index 8a358015ac..13ddbe2aff 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js +++ b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js @@ -78,9 +78,7 @@ $(document).ready(function() { return { "=": branchcode } }, "me.borrowernumber": function(){ - let borrowernumber_pre_filter = additional_prefilters.find(e => e.key === 'borrowernumber'); - if ( additional_prefilters.length == 0 || typeof borrowernumber_pre_filter === undefined) return ""; - return { "=": borrowernumber_pre_filter["value"] } + return (borrower_prefilter_value = get_prefilter_value('borrowernumber')) ? { "=": borrower_prefilter_value } : ""; }, "-or": function(){ let patron = $("#illfilter_patron").val(); @@ -178,7 +176,12 @@ $(document).ready(function() { } }; - var ill_requests_table = $("#ill-requests").kohaTable({ + let table_id = "#ill-requests"; + if (borrower_prefilter_value = get_prefilter_value('borrowernumber')) { + table_id += "-patron-" + borrower_prefilter_value; + } + + var ill_requests_table = $(table_id).kohaTable({ "ajax": { "url": '/api/v1/ill/requests' }, @@ -494,4 +497,9 @@ $(document).ready(function() { clearSearch(); }); + function get_prefilter_value(prefilter_key) { + let pre_filter = additional_prefilters.find(e => e.key === prefilter_key); + return additional_prefilters.length != 0 && typeof pre_filter !== "undefined" ? pre_filter['value'] : null; + } + }); -- 2.40.1
Request ID