Bugzilla – Attachment 151777 Details for
Bug 33786
ILL requests table pagination in patron ILL history is transposing for different patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33786: ILL requests table id
Bug-33786-ILL-requests-table-id.patch (text/plain), 4.17 KB, created by
Katrin Fischer
on 2023-05-29 14:33:58 UTC
(
hide
)
Description:
Bug 33786: ILL requests table id
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-05-29 14:33:58 UTC
Size:
4.17 KB
patch
obsolete
>From f3f7804b44f9d1a28d737a375db2d3a192596ff1 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Mon, 29 May 2023 11:15:33 +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 > >Reproduce: >1) Have a borrower with >20 ILL requests in their history >2) Visit cgi-bin/koha/members/ill-requests.pl?borrowernumber=<borrowernumber> >3) On the table, click page 2 >4) Visit a different borrower with <20 ILL requests >5) Verify that no requests are shown, this is because the table is using page 2 from step 3) >6) Go back to original borrower, click table page 1 >7) Now go back to 2nd borrower, verify is now showing page 1 correctly > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/includes/ill-list-table.inc | 4 +++ > .../intranet-tmpl/prog/js/ill-list-table.js | 35 ++++++++++++------- > 2 files changed, 26 insertions(+), 13 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 %] >+<table id="ill-requests-patron-[% patron.borrowernumber | html %]"> >+[% ELSE %] > <table id="ill-requests"> >+[% END %] > <thead> > <tr id="ill_requests_header"> > <th scope="col">Request ID</th> >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..849fd8f870 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js >@@ -55,17 +55,18 @@ $(document).ready(function() { > // see ill/ill-requests.pl and members/ill-requests.pl > let additional_prefilters = []; > if(prefilters){ >- let prefilters_array = prefilters.split("&"); >- prefilters_array.forEach((prefilter) => { >- let prefilter_split = prefilter.split("="); >- additional_prefilters.push( { >- "key": prefilter_split[0], >- "value": prefilter_split[1] >- } ); >- >- }); >+ let prefilters_array = prefilters.split("&"); >+ prefilters_array.forEach((prefilter) => { >+ let prefilter_split = prefilter.split("="); >+ additional_prefilters.push( { >+ "key": prefilter_split[0], >+ "value": prefilter_split[1] >+ } ); >+ }); > } > >+ let borrower_prefilter = get_prefilter_value('borrowernumber'); >+ > let additional_filters = { > "me.backend": function(){ > let backend = $("#illfilter_backend").val(); >@@ -78,9 +79,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 ? { "=": borrower_prefilter } : ""; > }, > "-or": function(){ > let patron = $("#illfilter_patron").val(); >@@ -178,7 +177,12 @@ $(document).ready(function() { > } > }; > >- var ill_requests_table = $("#ill-requests").kohaTable({ >+ let table_id = "#ill-requests"; >+ if (borrower_prefilter) { >+ table_id += "-patron-" + borrower_prefilter; >+ } >+ >+ var ill_requests_table = $(table_id).kohaTable({ > "ajax": { > "url": '/api/v1/ill/requests' > }, >@@ -494,4 +498,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.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33786
:
151487
|
151506
|
151511
|
151670
|
151773
|
151776
|
151777
|
151791
|
152036