Bug 11832 - JavaScript error on staff client place hold screen if record has no items
Summary: JavaScript error on staff client place hold screen if record has no items
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Owen Leonard
QA Contact: Marcel de Rooy
URL: /cgi-bin/koha/reserve/request.pl?bibl...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-24 16:26 UTC by Owen Leonard
Modified: 2015-06-04 23:30 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 11832 - JavaScript error on staff client place hold screen if record has no items (1.45 KB, patch)
2014-02-24 16:48 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED OFF] Bug 11832 - JavaScript error on staff client place hold screen if record has no items (1.77 KB, patch)
2014-02-28 14:31 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 11832 - JavaScript error on staff client place hold screen if record has no items (1.85 KB, patch)
2014-03-12 14:35 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 2014-06-06 13:59:35 UTC
Pushed to 3.12.x will be in 3.12.13