From 990b133fa7f44c22de2bfcac6a6f8055481b8203 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 Signed-off-by: Nick Clemens (cherry picked from commit 5a9bad787458411c790d26b3b115fe3e7e2e0ab2) Signed-off-by: Martin Renvoize (cherry picked from commit 50f4e8635056d7b664b846db91d48bf282fef949) Signed-off-by: Fridolin Somers --- .../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 0a6d6f62c8..d381c26bda 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 @@ -16,24 +16,26 @@ $('#current-article-requests').ready(function() { }); $(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.39.5