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>
This commit is contained in:
Jonathan Druart 2025-10-10 16:12:24 +02:00 committed by Laura Escamilla
parent ad5fcfc0fc
commit 775cc4c980
No known key found for this signature in database
GPG Key ID: B5DEB5FD2FCDA5D8
1 changed files with 1 additions and 19 deletions

View File

@ -764,11 +764,6 @@ function patron_autocomplete(node, options) {
item.link = null;
}
var cardnumber = "";
if (item.cardnumber != "") {
// Display card number in parentheses if it exists
cardnumber = " (" + item.cardnumber + ") ";
}
if (item.library_id == loggedInLibrary) {
loggedInClass = "ac-currentlibrary";
} else {
@ -780,20 +775,7 @@ function patron_autocomplete(node, options) {
.append(
"" +
(item.link ? '<a href="' + item.link + '">' : "<a>") +
(item.surname ? item.surname.escapeHtml() : "") +
", " +
(item.preferred_name
? item.preferred_name.escapeHtml()
: item.firstname
? item.firstname.escapeHtml()
: "") +
" " +
(item.middle_name ? item.middle_name.escapeHtml() : "") +
" " +
(item.other_name
? "(" + item.other_name.escapeHtml() + ")"
: "") +
cardnumber.escapeHtml() +
$patron_to_html(item, { display_cardnumber: true }) +
" " +
(item.date_of_birth
? $date(item.date_of_birth) +