Bug 37327

Summary: JS crash on patrons list when there is patron with empty name
Product: Koha Reporter: Peter Vashchuk <stalkernoid>
Component: PatronsAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, kyle.m.hall
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 37327: JS crash on patrons list when there is patron with empty name

Description Peter Vashchuk 2024-07-11 13:58:57 UTC
When a patron has an empty first name and surname, JS crashes on the patrons list page, causing the patron list to fail to load.

To reproduce:
1. Create a new or edit existing patron and set the "First Name" as empty and "Surname" as whitespace (' '), so both name and surname are empty.
2. Go to the patron search page and search to load the patron list, which will lead to JS crash and patron list not loading.
3. The error can be found in the console of your browser "Uncaught TypeError: Cannot read properties of undefined (reading 'name')"
Comment 1 Peter Vashchuk 2024-07-11 14:29:18 UTC
Patch that I will post below is a hotfix that we implemented on our production to somehow fix the issue but we did not do deep enough research to figure out if this is the right way to go about it and maybe it would be better to instead populate patron.library.name.
Comment 2 Peter Vashchuk 2024-07-11 14:30:37 UTC
Created attachment 168830 [details] [review]
Bug 37327: JS crash on patrons list when there is patron with empty name

To reproduce:
1. Create a new or edit existing patron and set the "First Name" as empty and "Surname" as whitespace (' '), so both name and surname are empty.
2. Go to the patron search page and do the search to load the patron list, which will lead to JS crash and patron list not loading.
3. Apply the patch.
4. Do step 2 again, this time the patron list should load properly.
Comment 3 Katrin Fischer 2024-07-18 16:32:52 UTC
It looks like this is duplicate to bug 37368 that is a more complete fix.

*** This bug has been marked as a duplicate of bug 37368 ***