Bug 23777: Use To.json in request.tt

Test plan:
Use quotes in a library's name, then place an item on hold for a patron
that cannot do it.
If you are allowed to overwrite this restriction you will get a warning:
"This item normally cannot be put on hold except for patrons from
BRANCHNAME"
The library's name should be correcty displayed

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2019-11-12 09:30:40 +01:00 committed by Martin Renvoize
parent d4cc6054e0
commit 63d831a144
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -1,4 +1,5 @@
[% USE raw %]
[% USE To %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
@ -953,10 +954,10 @@
var biblionumber = "[% biblionumber | $raw %]";
var borrowernumber = "[% patron.borrowernumber | $raw %]";
var MSG_CONFIRM_DELETE_HOLD = _("Are you sure you want to cancel this hold?");
var patron_homebranch = "[% Branches.GetName( patron.branchcode ) |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
[% itemloo.itemnumber | html %]: {
homebranch: "[% Branches.GetName( itemloo.homebranch ) |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]";
holdallowed: [% itemloo.holdallowed | html %]
},
[% END %][% END %][% END %]