From 82276c95ab199eff566982ff65fd21912410a67e Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 30 Aug 2019 12:25:45 +0000 Subject: [PATCH] Bug 23518: Problem with borrower search autocomplete This patch fixes a bug introduced by my patch for Bug 23405: Keyboard navigation of patron autocomplete results was broken because I incorrectly assumed that the autocomplete "select" action was redundant because keyboard navigation would trigger the selected link. It doesn't! This patch adds the "select" action back to the autocomplete configuration, explicitly defining a redirect to match the URL which is followed if the user uses the mouse to click a result. To test you should have a patron in your database which has no card number. Make sure CircAutocompl is enabled. - From the circulation home page, type a patron name in the "Check out" form and wait for autocomplete search results to display. - Making a selection from the autocomplete results should work by clicking with a mouse OR using the arrow keys and TAB or ENTER. - Test with patrons with and without card numbers. --- koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc index 1ca12ff3c62..7bff27a22d2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc @@ -87,9 +87,13 @@ var obj = $( "#findborrower" ).autocomplete({ source: "/cgi-bin/koha/circ/ysearch.pl", minLength: 3, + select: function( event, ui ) { + window.location.href = ui.item.link; + } }).data( "ui-autocomplete" ); if( obj ) { obj._renderItem = function( ul, item ) { + item.link = "/cgi-bin/koha/circ/circulation.pl?borrowernumber=" + item.borrowernumber; var cardnumber = ""; if( item.cardnumber != "" ){ // Display card number in parentheses if it exists @@ -97,7 +101,7 @@ } return $( "
  • " ) .data( "ui-autocomplete-item", item ) - .append( "" + item.surname + ", " + item.firstname + cardnumber + " " + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "" ) + .append( "" + item.surname + ", " + item.firstname + cardnumber + " " + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "" ) .appendTo( ul ); }; } -- 2.11.0