Bug 14322

Summary: Can't link to an item search
Product: Koha Reporter: Magnus Enger <magnus>
Component: SearchingAssignee: Galen Charlton <gmcharlt>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrewfh, blawlor, dubyk, heather_hernandez, hebah, katrin.fischer, lisette.scheer, lisettepalouse+koha, margaret
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27359
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35178
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 14322: Add button to copy link to an item search

Description Magnus Enger 2015-06-03 13:03:55 UTC
The new item search in the staff client is awesome, but a bit too AJAXy for my tastes. The main problem is that it is not possible to link to the results of a search. If you do a search and you want to show the results to a colleague, you have to explain what boxes to check, what to type where, what to select from what pulldown menus etc. If the search criteria were in the URL it could be done with simply copying and pasting the URL.
Comment 1 Katrin Fischer 2019-08-13 06:27:29 UTC
I'd love to see that as it would also help in support.
Comment 2 Lisette Scheer 2021-01-21 18:38:54 UTC
Being able to send an item search link to another staff member or the support team would be very helpful. 
Lisette
Comment 3 Brendan Lawlor 2024-04-16 21:13:07 UTC
Created attachment 164962 [details] [review]
Bug 14322: Add button to copy link to an item search

This work in progress patch adds a button to copy a url with all the parameters for an item search. The button currently works to copy a url with all the item search parameters url encoded, but the url returns 500.To make it work itemsearch.pl needs some updates to handle when the url parameter shareable=1, then it should process all the prameters from the url.

Test plan:
1. Apply patch
2. Do an item search
3. On the results page see a new 'Copy shareable link' button
4. Click the button and confirm that you can paste a url with all parameters from the form url encoded
5. Paste the url in the browser and notice you get a 500 error :(
Comment 4 Brendan Lawlor 2024-04-16 21:26:28 UTC
Posting this patch for feedback.

itemsearch.pl overrides the form submit button and gets an array of objects for all the parameters.

This patch uses the same code that processes the form inputs into an array of objects, which is used in the ajax call to update the #results dataTable.

It takes that array of parameters and uses jquery to parameterize it into a url encoded string.

I think the remaining changes should be pretty minimal the encoded url is just a different way of representing the same data it already processes with the ajax call.