Bug 36099: count and holdcount template vars into JS vars should default to 0 if empty

Visit:
http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=4321
Notice you have 2 console errors:
1) Uncaught SyntaxError: Unexpected token ';'
2) Uncaught ReferenceError: biblionumber is not defined

Apply patch. Repeat. Notice no error shows.
Visit an existing biblionumber. Confirm all is well.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f94d763b6a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Pedro Amorim 2024-02-26 10:03:22 +00:00 committed by Fridolin Somers
parent 4984835a94
commit d4e1ea5d71

View file

@ -3,8 +3,8 @@
<script> <script>
/* Some required variables from the template */ /* Some required variables from the template */
var biblionumber = [% biblionumber | html %]; var biblionumber = [% biblionumber | html %];
var count = [% count | html %]; var count = [% count || 0 | html %];
var holdcount = [% holdcount | html %]; var holdcount = [% holdcount || 0 | html %];
[% SET orders = biblio.orders %] [% SET orders = biblio.orders %]
[% SET current = Context.Scalar(orders, "filter_by_current") %] [% SET current = Context.Scalar(orders, "filter_by_current") %]
[% SET cancelled = Context.Scalar(orders, "filter_by_cancelled") %] [% SET cancelled = Context.Scalar(orders, "filter_by_cancelled") %]