Bug 40995 - Patron search autocomplete adds extraneous spacing and punctuation when patron lacks surname
Summary: Patron search autocomplete adds extraneous spacing and punctuation when patro...
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Nick Clemens (kidclamp)
URL:
Keywords:
Depends on: 32176
Blocks: 40245
  Show dependency treegraph
 
Reported: 2025-10-10 14:13 UTC by Andrew Fuerste-Henry
Modified: 2026-02-18 15:27 UTC (History)
3 users (show)

See Also:
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, 25.05.08
Circulation function:


Attachments
Bug 40995: Use patron_to_html in patron autocomplete (2.27 KB, patch)
2025-10-10 14:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40995: Use patron_to_html in patron autocomplete (2.33 KB, patch)
2025-10-10 15:07 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 40995: Add Cypress tests (1.82 KB, patch)
2025-10-13 14:00 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40995: (follow-up) pass invert_name in patron autocomplete (1.23 KB, patch)
2025-10-13 20:05 UTC, CJ Lynce
Details | Diff | Splinter Review
Bug 40995: Use patron_to_html in patron autocomplete (2.39 KB, patch)
2025-10-31 11:18 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 40995: Add Cypress tests (1.87 KB, patch)
2025-10-31 11:18 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 40995: (follow-up) pass invert_name in patron autocomplete (1.29 KB, patch)
2025-10-31 11:18 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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
Comment 10 Laura Escamilla 2026-02-17 16:48:26 UTC
This patch doesn’t apply cleanly to 25.05, so I’m not planning to backport it at this time. If you’re able to update it for 25.05 compatibility, I’d be happy to take another look.
Comment 11 Laura Escamilla 2026-02-18 15:27:33 UTC
I’ve revisited this bug and decided to backport it to 25.05.x. Thank you for your patience with the change in direction.