Opening the holds page for a title which has no items attached triggers a JavaScript error: TypeError: $(...).autocomplete(...).data(...) is undefined /cgi-bin/koha/reserve/request.pl?biblionumber=X Line 313
Created attachment 25590 [details] [review] Bug 11832 - JavaScript error on staff client place hold screen if record has no items If a hold operation is blocked because the title has no items attached the patron search autocomplete JavaScript triggers an error. This patch modifies the template so that the JS is loaded only when items are present. To test, find a title which has no items attached. View the holds page for that title. There should be no JavaScript error. Patron search autocomplete should still work correctly for titles which have items attached.
Created attachment 25719 [details] [review] [SIGNED OFF] Bug 11832 - JavaScript error on staff client place hold screen if record has no items If a hold operation is blocked because the title has no items attached the patron search autocomplete JavaScript triggers an error. This patch modifies the template so that the JS is loaded only when items are present. To test, find a title which has no items attached. View the holds page for that title. There should be no JavaScript error. Patron search autocomplete should still work correctly for titles which have items attached. Deleted all items from a biblio record. Clicked the holds tab and confirmed using firebug Javascript error occurs. Applied patch, confirmed that the Javascript error described in comment 1 no longer happens. Went to another biblio with items, and confirmed patron auto-complete still functions. Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Created attachment 26183 [details] [review] Bug 11832 - JavaScript error on staff client place hold screen if record has no items If a hold operation is blocked because the title has no items attached the patron search autocomplete JavaScript triggers an error. This patch modifies the template so that the JS is loaded only when items are present. To test, find a title which has no items attached. View the holds page for that title. There should be no JavaScript error. Patron search autocomplete should still work correctly for titles which have items attached. Deleted all items from a biblio record. Clicked the holds tab and confirmed using firebug Javascript error occurs. Applied patch, confirmed that the Javascript error described in comment 1 no longer happens. Went to another biblio with items, and confirmed patron auto-complete still functions. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Indentation in reserve.tt is horrible; so checking this by glancing through template and script is not trivial. At the same time item refers to a patron in autocomplete to make the obscurity complete too :) Verified that it works. Passed QA
Pushed to master. Thanks, Owen!
Pushed to 3.14.x, will be in 3.14.08
Pushed to 3.12.x will be in 3.12.13