Bug 37368 - Patron searches break when surname and firstname are set to NULL
Summary: Patron searches break when surname and firstname are set to NULL
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
: 37327 (view as bug list)
Depends on:
Blocks: 38549
  Show dependency treegraph
 
Reported: 2024-07-15 21:36 UTC by Lucas Gass (lukeg)
Modified: 2024-12-06 08:45 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes an error when searching for patrons in the staff interface (for both the search in the header and the sidebar). If you have a patron without a last name or first name, and search using a space, the search did not complete and generated a browser console error.
Version(s) released in:
24.11.00,24.05.06
Circulation function:


Attachments
Bug 37368: Change library.name to library_id (1.25 KB, patch)
2024-07-15 21:38 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 37368: Change library.name to library_id (1.30 KB, patch)
2024-07-16 02:06 UTC, David Nind
Details | Diff | Splinter Review
Bug 37368: Add 'library' to patron search embed (2.07 KB, patch)
2024-07-17 15:45 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37368: Add 'library' to patron search embed (4.31 KB, patch)
2024-07-17 15:50 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37368: Add 'library' to patron search embed (4.35 KB, patch)
2024-07-17 15:53 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 37368: Add 'library' to patron search embed (4.42 KB, patch)
2024-07-17 16:36 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2024-07-15 21:36:21 UTC
To recreate:

1: update borrowers set surname = NULL where borrowernumber = 19;
2. update borrowers set firstname = NULL where borrowernumber = 19;
3. Perform a patron search, see the console error:

Uncaught TypeError: patron.library is undefined

patron.library.name in js-patron-format.inc feels like a typo. Should be patron.library_id



patron.library_name isn't a thing.
Comment 1 Lucas Gass (lukeg) 2024-07-15 21:38:41 UTC
Created attachment 169030 [details] [review]
Bug 37368: Change library.name to library_id

To test:
1: update borrowers set surname = NULL where borrowernumber = 19;
2. update borrowers set firstname = NULL where borrowernumber = 19;
3. Perform a patron search, see the console error and the patron search never completes.
4. APPLY PATCH and try searching again.
5. Search completes.
Comment 2 David Nind 2024-07-16 01:57:30 UTC
Sorry, I can't replicate the issue. I tried in both Firefox and Chromium:

1. Go to Patrons.
2. Use the header search box to search for a patron (for example, Mary).
3. Autocomplete comes up as expected, and patron record displays as expected.
4. No console errors.
5. Same with left-hand side "Search for patron" on the Patrons page (entered Mary then the search button).
Comment 3 David Nind 2024-07-16 02:06:01 UTC
Update: I can get the console error if I enter a space in the search box and press enter, and the same with the search on the left.
Comment 4 David Nind 2024-07-16 02:06:39 UTC
Created attachment 169032 [details] [review]
Bug 37368: Change library.name to library_id

To test:
1: update borrowers set surname = NULL where borrowernumber = 19;
2. update borrowers set firstname = NULL where borrowernumber = 19;
3. Perform a patron search, see the console error and the patron search never completes.
4. APPLY PATCH and try searching again.
5. Search completes.

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Martin Renvoize (ashimema) 2024-07-17 15:45:11 UTC
Created attachment 169093 [details] [review]
Bug 37368: Add 'library' to patron search embed

This patch adds the missing library embed from the patron search forms.
This embed is required for the case where a patron is missing both first
and last name or is from a different library group and thus falls into
the 'Patron from library X' block.

I also update the 'Patron from library X' to 'Patron from X' as I feel
it reads more clearly.
Comment 6 Martin Renvoize (ashimema) 2024-07-17 15:50:05 UTC
Created attachment 169095 [details] [review]
Bug 37368: Add 'library' to patron search embed

This patch adds the missing library embed from the patron search forms.
This embed is required for the case where a patron is missing both first
and last name or is from a different library group and thus falls into
the 'Patron from library X' block.

I also update the 'Patron from library X' to 'Patron from X' as I feel
it reads more clearly.

Finally, we need to sync the available embeds to ensure 'library' is
embeddable from the different endpoints this search can be triggered on.
Comment 7 Lucas Gass (lukeg) 2024-07-17 15:53:31 UTC
Created attachment 169096 [details] [review]
Bug 37368: Add 'library' to patron search embed

This patch adds the missing library embed from the patron search forms.
This embed is required for the case where a patron is missing both first
and last name or is from a different library group and thus falls into
the 'Patron from library X' block.

I also update the 'Patron from library X' to 'Patron from X' as I feel
it reads more clearly.

Finally, we need to sync the available embeds to ensure 'library' is
embeddable from the different endpoints this search can be triggered on.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 8 Kyle M Hall (khall) 2024-07-17 16:36:05 UTC
Created attachment 169106 [details] [review]
Bug 37368: Add 'library' to patron search embed

This patch adds the missing library embed from the patron search forms.
This embed is required for the case where a patron is missing both first
and last name or is from a different library group and thus falls into
the 'Patron from library X' block.

I also update the 'Patron from library X' to 'Patron from X' as I feel
it reads more clearly.

Finally, we need to sync the available embeds to ensure 'library' is
embeddable from the different endpoints this search can be triggered on.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 9 Katrin Fischer 2024-07-18 15:57:45 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 10 Katrin Fischer 2024-07-18 16:32:52 UTC
*** Bug 37327 has been marked as a duplicate of this bug. ***
Comment 11 Alex Buckley 2024-11-18 03:25:38 UTC
Hi everyone,

We have found this bug is happening on earlier Koha versions including 24.05.

Please can this fix be backported to 24.05 and 23.11?

Thanks,
Alex
Comment 12 Lucas Gass (lukeg) 2024-11-18 18:22:45 UTC
Backported to 24.05.x for upcoming 24.05.06
Comment 13 Alex Buckley 2024-11-19 21:10:49 UTC
(In reply to Lucas Gass (lukeg) from comment #12)
> Backported to 24.05.x for upcoming 24.05.06

Thank you very much for backporting.
Comment 14 Fridolin Somers 2024-12-06 08:45:04 UTC
Does not apply on 23.11.x looks like because of Bug 33568
Please provide rebased patch if you can