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 <maryse.simard@inlibro.com>
Followed the test plan and it works.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2018-07-13 17:49:14 +00:00
parent c02543baaa
commit 5a9bad7874

View file

@ -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 $( "<li></li>" )
.data( "ui-autocomplete-item", item )
.append( "<a>" + item.surname + ", " + item.firstname +
" (" + item.cardnumber + ") <small>" + item.address +
" " + item.city + " " + item.zipcode + " " +
item.country + "</small></a>" )
.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 $( "<li></li>" )
.data( "ui-autocomplete-item", item )
.append( "<a>" + item.surname + ", " + item.firstname +
" (" + item.cardnumber + ") <small>" + item.address +
" " + item.city + " " + item.zipcode + " " +
item.country + "</small></a>" )
.appendTo( ul );
};
[% END %]
$( ".ar-update-branchcode" ).on('focus', function(){
previous_branchcode = this.value;