From d7b70d2a40cb4c2591fc06ca0bdc01ee152162a7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 10 Oct 2025 16:12:24 +0200 Subject: [PATCH] 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 --- .../intranet-tmpl/prog/js/staff-global.js | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index ed6f0b35f7b..36cda8e7673 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -765,11 +765,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 { @@ -781,20 +776,7 @@ function patron_autocomplete(node, options) { .append( "" + (item.link ? '' : "") + - (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) + -- 2.39.5