Bug 34592

Summary: The patron search window, given just a sort field value, doesn't work
Product: Koha Reporter: Michael Hafen <michael.hafen>
Component: Label/patron card printingAssignee: Michael Hafen <michael.hafen>
Status: RESOLVED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: trivial    
Priority: P5 - low CC: dcook, fridolin.somers, jonathan.druart
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.04,22.11.10
Bug Depends on: 28726    
Bug Blocks:    
Attachments: Bug 34592: Patron Search filter fields needs to be at least an empty array
ug 34592: Patron Search filter fields needs to be at least an empty array
Bug 34592: Patron Search filter fields needs to be at least an empty array
Bug 34592: Patron Search filter fields needs to be at least an empty array

Description Michael Hafen 2023-08-22 18:04:21 UTC
In the patron card creator, card batch. When doing a patron search in the patron search window, if only a sort field value is given the form gets submitted and the patron search window comes back without the sort fields.
Comment 1 Michael Hafen 2023-08-22 18:23:54 UTC
Created attachment 154703 [details] [review]
Bug 34592: Patron Search filter fields needs to be at least  an empty array
Comment 2 Owen Leonard 2023-08-24 13:18:47 UTC
The attachment has only a test plan, no patch!
Comment 3 Michael Hafen 2023-08-24 16:29:11 UTC
Created attachment 154742 [details] [review]
ug 34592: Patron Search filter fields needs to be at least  an empty array

(Sorry.  I don't know how that happened.)

If buildPatronSearchQuery() doesn't return an empty array when it exits
early, then the code that adds the sort fields to the filters will fail.

Test plan:

If there is not all ready a patron with a sort1 or sort2 value from the
  bSort1 or bSort2 authorized values, add an authorized value if necessary,
  add a patron if necessary, and set the patrons sort field to the added value.
In Tools -> Patron card creator start a new card batch.
Click on Add Patron(s) to open the patron search window.
pick the value in either the sort1 or sort2 drop down.
Submit the page.  The page will reload and there won't be results.
Apply the patch, close the patron search window, clear the browser cache,
  reload the "New patron card batch" page, and open the patron search window
  again.
Repeat the search. There will be results.
Comment 4 Owen Leonard 2023-08-25 11:29:21 UTC
Created attachment 154802 [details] [review]
Bug 34592: Patron Search filter fields needs to be at least an empty array

If buildPatronSearchQuery() doesn't return an empty array when it exits
early, then the code that adds the sort fields to the filters will fail.

Test plan:

- If there is not all ready a patron with a sort1 or sort2 value from
  the bSort1 or bSort2 authorized values, add an authorized value if
  necessary.
- Add a patron if necessary, and set the patrons sort field to the added
  value.
- In Tools -> Patron card creator start a new card batch.
- Click on Add Patron(s) to open the patron search window.
- Pick the value in either the sort1 or sort2 drop down.
- Submit the page.  The page will reload and there won't be results.
- Apply the patch, close the patron search window, clear the browser
  cache, reload the "New patron card batch" page, and open the patron
  search window again.
- Repeat the search. There will be results.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Katrin Fischer 2023-08-25 12:10:46 UTC
Created attachment 154806 [details] [review]
Bug 34592: Patron Search filter fields needs to be at least an empty array

If buildPatronSearchQuery() doesn't return an empty array when it exits
early, then the code that adds the sort fields to the filters will fail.

Test plan:

- If there is not all ready a patron with a sort1 or sort2 value from
  the bSort1 or bSort2 authorized values, add an authorized value if
  necessary.
- Add a patron if necessary, and set the patrons sort field to the added
  value.
- In Tools -> Patron card creator start a new card batch.
- Click on Add Patron(s) to open the patron search window.
- Pick the value in either the sort1 or sort2 drop down.
- Submit the page.  The page will reload and there won't be results.
- Apply the patch, close the patron search window, clear the browser
  cache, reload the "New patron card batch" page, and open the patron
  search window again.
- Repeat the search. There will be results.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Tomás Cohen Arazi 2023-08-30 13:06:57 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 7 Jonathan Druart 2023-08-30 13:08:55 UTC
Any changes to patron search should add selenium tests.
Comment 8 Fridolin Somers 2023-08-30 20:18:38 UTC
Pushed to 23.05.x for 23.05.04
Comment 9 Matt Blenkinsop 2023-08-31 10:47:26 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x