From 664ef1a9d592db2e04a3ec2aab5d4d6fad24f25a Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 22 Aug 2025 19:49:52 +0000 Subject: [PATCH] Bug 38967: Make exportItems use POST To test: 1. Go to item search. 2. Enter parameters that retrieve more than 500 items. 3. From the item search results page, show All entries, then "Select visible rows." 4. Select either Export selected results to CSV or Barcode file. 5. A resulting error message of either "This site can't be reached. The connection was reset" or a 400 Bad request page with a URL with all the item numbers inserted appears. 6. APPLY PATCH Try steps 1 - 4 again, this time it should export. Signed-off-by: Eric Garcia --- .../prog/en/modules/catalogue/itemsearch.tt | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt index a050fdf52e..32d7377c12 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt @@ -430,11 +430,23 @@ } function exportItems(format) { - let item_search_selections = JSON.parse( localStorage.getItem("item_search_selections") ) || []; + let item_search_selections = JSON.parse(localStorage.getItem("item_search_selections")) || []; if (item_search_selections.length > 0) { - var href = '/cgi-bin/koha/catalogue/item-export.pl?format=' + format; - href += '&itemnumber=' + Array.from( item_search_selections ).join('&itemnumber='); - location = href; + let inputs = item_search_selections.map(itemnumber => + `` + ).join(''); + + let form = $(` +
+ [% INCLUDE 'csrf-token.inc' %] + + ${inputs} +
+ `); + + $('body').append(form); + form.submit(); + form.remove(); } else { $('#format-' + format).prop('checked', true); $('#itemsearchform').submit(); -- 2.39.5