Bug 40995

Summary: Patron search autocomplete adds extraneous spacing and punctuation when patron lacks surname
Product: Koha Reporter: Andrew Fuerste-Henry <andrew>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to main --- QA Contact: Nick Clemens (kidclamp) <nick>
Severity: normal    
Priority: P5 - low CC: cj.lynce, nick
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00
Circulation function:
Bug Depends on: 32176    
Bug Blocks: 40245    
Attachments: Bug 40995: Use patron_to_html in patron autocomplete
Bug 40995: Use patron_to_html in patron autocomplete
Bug 40995: Add Cypress tests
Bug 40995: (follow-up) pass invert_name in patron autocomplete
Bug 40995: Use patron_to_html in patron autocomplete
Bug 40995: Add Cypress tests
Bug 40995: (follow-up) pass invert_name in patron autocomplete

Description Andrew Fuerste-Henry 2025-10-10 14:13:59 UTC
If your autocomplete results include a patron without a surname, Koha still puts a comma and space between the first name and the nonexistent surname, like ", Henry."
Comment 1 Jonathan Druart 2025-10-10 14:15:46 UTC
Created attachment 187739 [details] [review]
Bug 40995: Use patron_to_html in patron autocomplete

So we deal with punctuation like in other places.

If your autocomplete results include a patron without a surname,
Koha still puts a comma and space between the first name and the nonexistent surname, like ", Henry."
Comment 2 Andrew Fuerste-Henry 2025-10-10 15:07:50 UTC
Created attachment 187745 [details] [review]
Bug 40995: Use patron_to_html in patron autocomplete

So we deal with punctuation like in other places.

If your autocomplete results include a patron without a surname,
Koha still puts a comma and space between the first name and the nonexistent surname, like ", Henry."

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Comment 3 Jonathan Druart 2025-10-13 14:00:07 UTC
Created attachment 187843 [details] [review]
Bug 40995: Add Cypress tests
Comment 4 CJ Lynce 2025-10-13 20:03:28 UTC
Previously the patron autocomplete results had names in inverted format (surname first). The call to patron_to_html() needs 'invert_name: true' passed to keep existing format, so that cypress tests are happy.
Comment 5 CJ Lynce 2025-10-13 20:05:23 UTC
Created attachment 187850 [details] [review]
Bug 40995: (follow-up) pass invert_name in patron autocomplete

Passes invert_name flag to patron_to_html to restore previous
format in patron autocomplete.
Comment 6 Nick Clemens (kidclamp) 2025-10-31 11:18:00 UTC
Created attachment 188808 [details] [review]
Bug 40995: Use patron_to_html in patron autocomplete

So we deal with punctuation like in other places.

If your autocomplete results include a patron without a surname,
Koha still puts a comma and space between the first name and the nonexistent surname, like ", Henry."

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Nick Clemens (kidclamp) 2025-10-31 11:18:03 UTC
Created attachment 188809 [details] [review]
Bug 40995: Add Cypress tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 8 Nick Clemens (kidclamp) 2025-10-31 11:18:05 UTC
Created attachment 188810 [details] [review]
Bug 40995: (follow-up) pass invert_name in patron autocomplete

Passes invert_name flag to patron_to_html to restore previous
format in patron autocomplete.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 9 Lucas Gass (lukeg) 2025-10-31 21:30:38 UTC
Nice work everyone!

Pushed to main for 25.11