Bug 11829

Summary: JavaScript error on staff client biblio details pages if template variables are undefined
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, gmcharlt, gwilliams, jesse, katrin.fischer, veron
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Medium patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 9780, 9823    
Bug Blocks: 11836, 11821    
Attachments: Bug 11829 - JavaScript error on staff client biblio details pages if template variables are undefined
[Signed-off] Bug 11829 - JavaScript error on staff client biblio details pages if template variables are undefined
[PASSED QA] Bug 11829 - JavaScript error on staff client biblio details pages if template variables are undefined

Description Owen Leonard 2014-02-24 15:18:47 UTC
In the JavaScript included in cat-toolbar.inc:

 var holdcount = [% holdcount %]

If [% holdcount %] is undefined that line triggers an error.
Comment 1 Owen Leonard 2014-02-24 15:31:09 UTC
Looks like this was caused by the QA follow-up to 9823
Comment 2 Owen Leonard 2014-02-24 16:19:49 UTC Comment hidden (obsolete)
Comment 3 Owen Leonard 2014-02-24 16:29:51 UTC
*** Bug 11831 has been marked as a duplicate of this bug. ***
Comment 4 Marc Véron 2014-02-24 17:24:07 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2014-02-25 07:17:49 UTC
Created attachment 25604 [details] [review]
[PASSED QA] Bug 11829 - JavaScript error on staff client biblio details pages if template variables are undefined

The JavaScript included in cat-toolbar.inc expects several variables to
be passed to the template for use in calculations. Several scripts
to not pass the required variables to the template, leading to a JS
error.

This patch re-adds (See Bug 9823) hold count calculation to the required
scripts and copies the acquisitions-related count calculation from
detail.pl into related bibliographic detail scripts so that the
commonnly-included cat-toolbar.inc can receive correct values.

To test, locate a bibliographic record which has no holds and is not
used in a current or deleted order, but which has a local cover image
attached. Check the following views to confirm there is no JavaScript
error:

- Normal
- MARC
- Labeled MARC
- ISBD
- Items
- Images (from the Images tab on the "Normal" detail page)

Next, locate a bibliographic record with no items attached which is used
in an Acquisitions order. On each of the pages listed above, choose
"Delete record" from the Edit menu. This should trigger a warning that
the record is used in an order. Cancel the deletion.

Finally, delete the order which references the bibliographic record. On
each of the pages listed above, choose "Delete record" again. This
should trigger a warning that the record is used in a deleted order.
Cancel the deletion.

I went through the test plan, everything works OK.
It resolves Bug 11831 as well.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
- Printing from MARC and ISBD view works again
- No more Javascript errors found
- Deleting a record with attached order gives the correct warning,
  both for ordered and cancelled.

Passes all tests and QA script.
Comment 6 Galen Charlton 2014-02-27 16:08:36 UTC
Pushed to master.  Thanks, Owen!

I've opened bug 11836 for the code duplication (re)introduced by this patch.
Comment 7 Kyle M Hall 2014-04-24 17:26:00 UTC
*** Bug 11841 has been marked as a duplicate of this bug. ***
Comment 8 Fridolin Somers 2014-05-19 13:09:32 UTC
This patch corrects also the feature added by bug 9780.
Comment 9 Fridolin Somers 2014-05-27 10:27:48 UTC
Pushed to 3.14.x, will be in 3.14.07

(Quite a dirty bug)