Bug 11832

Summary: JavaScript error on staff client place hold screen if record has no items
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, gmcharlt, kyle, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
URL: /cgi-bin/koha/reserve/request.pl?biblionumber=X
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 11832 - JavaScript error on staff client place hold screen if record has no items
[SIGNED OFF] Bug 11832 - JavaScript error on staff client place hold screen if record has no items
Bug 11832 - JavaScript error on staff client place hold screen if record has no items

Description Owen Leonard 2014-02-24 16:26:13 UTC
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
Comment 1 Owen Leonard 2014-02-24 16:48:48 UTC Comment hidden (obsolete)
Comment 2 Mark Tompsett 2014-02-28 14:31:35 UTC Comment hidden (obsolete)
Comment 3 Marcel de Rooy 2014-03-12 14:35:57 UTC
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>
Comment 4 Marcel de Rooy 2014-03-12 14:39:27 UTC
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
Comment 5 Galen Charlton 2014-03-12 14:58:53 UTC
Pushed to master.  Thanks, Owen!
Comment 6 Fridolin Somers 2014-06-04 09:54:51 UTC
Pushed to 3.14.x, will be in 3.14.08
Comment 7 Kyle M Hall (khall) 2014-06-06 13:59:35 UTC
Pushed to 3.12.x will be in 3.12.13