Bug 36272 - Exporting too many items from item search gives "Request-URI Too Long"
Summary: Exporting too many items from item search gives "Request-URI Too Long"
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-07 12:41 UTC by Magnus Enger
Modified: 2024-03-07 12:46 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2024-03-07 12:41:37 UTC
To reproduce in KTD:

- Login to the staff client
- Go to "Item search"
- Click on "Search" without adding any limitations
- Change to "Show [All] entries" - this should show about 961 items
- Click on "Select visible rows"
- Click on "Export selected results (961) to" and choose "Barcode file"
- This should result in this error: 

Request-URI Too Long
The requested URL's length exceeds the capacity limit for this server.

The URL of the page that shows the error looks like this: 

http://localhost:8081/cgi-bin/koha/catalogue/item-export.pl?format=barcodes&itemnumber=513&itemnumber=514&itemnumber=515&itemnumber=574&itemnumber=124&itemnumber=125&itemnumber=126& etc etc

The solution is probably to do a POST, not a GET? 

Similar to bug 32278, but in a different area.
Comment 1 Magnus Enger 2024-03-07 12:46:28 UTC
Relevant code in koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt:

            $("body").on("click", "#barcodesExportLink", function(e){
                e.preventDefault();
                exportItems('barcodes');
            });

        function exportItems(format) {
            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;
            } else {
                $('#format-' + format).prop('checked', true);
                $('#itemsearchform').submit();
                $('#format-html').prop('checked', true);
            }
        }

Export to CSV has the same problem.