From bc57a57018e3b8e3302bf03020941f38f80e192e Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 13 Jul 2018 17:49:14 +0000 Subject: [PATCH] Bug 21076: Don't call autocomplete code after patron found To test: 1 - Enable article requests 2 - Search on staff client 3 - Click 'Request article' 4 - Find a patron 5 - View error in console 6 - Apply patch 7 - Reload 8 - Not error is gone Signed-off-by: Maryse Simard Followed the test plan and it works. Signed-off-by: Katrin Fischer --- .../prog/en/modules/circ/request-article.tt | 38 ++++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt index ca1aa1b..94d9b33 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt @@ -305,24 +305,26 @@ }); $(document).ready(function() { - $( "#patron" ).autocomplete({ - source: "/cgi-bin/koha/circ/ysearch.pl", - minLength: 3, - select: function( event, ui ) { - $( "#patron" ).val( ui.item.cardnumber ); - $( "#holds_patronsearch" ).submit(); - return false; - } - }) - .data( "ui-autocomplete" )._renderItem = function( ul, item ) { - return $( "
  • " ) - .data( "ui-autocomplete-item", item ) - .append( "" + item.surname + ", " + item.firstname + - " (" + item.cardnumber + ") " + item.address + - " " + item.city + " " + item.zipcode + " " + - item.country + "" ) - .appendTo( ul ); - }; + [% UNLESS (patron ) %] + $( "#patron" ).autocomplete({ + source: "/cgi-bin/koha/circ/ysearch.pl", + minLength: 3, + select: function( event, ui ) { + $( "#patron" ).val( ui.item.cardnumber ); + $( "#holds_patronsearch" ).submit(); + return false; + } + }) + .data( "ui-autocomplete" )._renderItem = function( ul, item ) { + return $( "
  • " ) + .data( "ui-autocomplete-item", item ) + .append( "" + item.surname + ", " + item.firstname + + " (" + item.cardnumber + ") " + item.address + + " " + item.city + " " + item.zipcode + " " + + item.country + "" ) + .appendTo( ul ); + }; + [% END %] $( ".ar-update-branchcode" ).on('focus', function(){ previous_branchcode = this.value; -- 2.1.4