Bug 35303

Summary: Staff interface header - patron search autocomplete no longer works (Uncaught TypeError: search_fields.forEach is not a function)
Product: Koha Reporter: David Nind <david>
Component: Staff interfaceAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: fridolin.somers, gmcharlt
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00
Circulation function:
Bug Depends on: 26916    
Bug Blocks:    
Attachments: Bug 35303: (bug 26916 follow-up) Fix paton autocomplete
Bug 35303: (bug 26916 follow-up) Fix paton autocomplete
Bug 35303: (bug 26916 follow-up) Fix paton autocomplete

Description David Nind 2023-11-09 13:24:03 UTC
The patron search autocomplete is no longer working in master (it was working yesterday, it wasn't after I did a git pull for Koha).

To replicate:
1. In the staff interface, start a search for a patron in the header (with check out selected), for example: mary
2. Notice that the autocomplete results are not displayed, and that there is a spinner going round just before the search button.
3. Under web developer tools note that there is a JavaScript error in the console:

Uncaught TypeError: search_fields.forEach is not a function
    buildPatronSearchQuery http://127.0.0.1:8081/intranet-tmpl/prog/js/staff-global_23.0600073.js:615
    buildPatronSearchQuery http://127.0.0.1:8081/intranet-tmpl/prog/js/staff-global_23.0600073.js:613
    source http://127.0.0.1:8081/intranet-tmpl/prog/js/staff-global_23.0600073.js:453
    jQuery 6
Comment 1 Jonathan Druart 2023-11-09 14:11:37 UTC
Created attachment 158717 [details] [review]
Bug 35303: (bug 26916 follow-up) Fix paton autocomplete

Fix the following JS error:
Uncaught TypeError: search_fields.forEach is not a function
Comment 2 David Nind 2023-11-09 14:36:14 UTC
Created attachment 158721 [details] [review]
Bug 35303: (bug 26916 follow-up) Fix paton autocomplete

Fix the following JS error:
Uncaught TypeError: search_fields.forEach is not a function

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Nind 2023-11-09 14:36:34 UTC
Thanks Jonathan!
Comment 4 Pedro Amorim 2023-11-09 15:03:17 UTC
Created attachment 158742 [details] [review]
Bug 35303: (bug 26916 follow-up) Fix paton autocomplete

Fix the following JS error:
Uncaught TypeError: search_fields.forEach is not a function

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 5 Tomás Cohen Arazi (tcohen) 2023-11-09 17:44:18 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 6 Fridolin Somers 2023-11-11 07:16:31 UTC
Depends on Bug 26916 not in 23.05.x