Bugzilla – Attachment 58289 Details for
Bug 17790
Fix js error on undefined autocomplete(...).data(...) in js_includes.inc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17790: Fix js error on undefined autocomplete(...).data(...)
Bug-17790-Fix-js-error-on-undefined-autocompleteda.patch (text/plain), 2.79 KB, created by
Jonathan Druart
on 2016-12-20 13:06:46 UTC
(
hide
)
Description:
Bug 17790: Fix js error on undefined autocomplete(...).data(...)
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-12-20 13:06:46 UTC
Size:
2.79 KB
patch
obsolete
>From 2ca36a27468570de8fade5a43b44c6f204b3e0b6 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 19 Dec 2016 12:55:59 +0100 >Subject: [PATCH] Bug 17790: Fix js error on undefined > autocomplete(...).data(...) > >Bug 17418 moved some code to js_includes.inc. >But if #findborrower does not exist, you cannot define _renderItem. >Trivial fix. > >Test plan: >[1] Find a page where this include is used and #findborrowers is absent. > Like about.pl >[2] Without this patch, you will have a js error in the js console. >[3] With this patch, you should no longer have it. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > .../intranet-tmpl/prog/en/includes/js_includes.inc | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > >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 326f22a..414425a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >@@ -89,7 +89,7 @@ > [% IF ( CircAutocompl ) %] > <script type="text/javascript"> > $(document).ready(function(){ >- $( "#findborrower" ).autocomplete({ >+ var obj = $( "#findborrower" ).autocomplete({ > source: "/cgi-bin/koha/circ/ysearch.pl", > minLength: 3, > select: function( event, ui ) { >@@ -97,13 +97,15 @@ > $("#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.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >- .appendTo( ul ); >- }; >+ }).data( "ui-autocomplete" ); >+ if( obj ) { >+ obj._renderItem = function( ul, item ) { >+ return $( "<li></li>" ) >+ .data( "ui-autocomplete-item", item ) >+ .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >+ .appendTo( ul ); >+ }; >+ } > }); > </script> > [% END %] >-- >2.9.3
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17790
:
58273
|
58274
| 58289