Bug 42443: (QA follow-up) Fix escaping of branchcode in JS context

Using | html to embed a TT value inside a JS string literal is
incorrect: it produces HTML entities rather than JS-safe characters.
Store the branchcode in a data attribute (where | html is correct)
and read it from there in JavaScript.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-06-11 17:23:58 +01:00 committed by Pedro Amorim
parent 16b2ac663e
commit 19d1db91d2
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 3 additions and 11 deletions

View File

@ -39,7 +39,7 @@
[% IF ( TransfersMaxDaysWarning ) %]<p>Transfers are <span class="error">considered late</span> after [% TransfersMaxDaysWarning | html %] days.</p>[% END %]
<div id="resultlist">
<div class="page-section">
<table id="transferstoreceive"></table>
<table id="transferstoreceive" data-branchcode="[% branchcode | html %]"></table>
</div>
<!-- /.page-section -->
</div>
@ -68,7 +68,7 @@
<script nonce="[% Koha.CSPNonce | $raw %]">
$(document).ready(function () {
var additional_filters = {
to_library_id: "[% branchcode | html %]",
to_library_id: $("#transferstoreceive").data("branchcode"),
sent_date: { "!=": null },
arrived_date: { "=": null },
cancellation_date: { "=": null },
@ -82,15 +82,7 @@
language: {
emptyTable: _("No transfers to receive"),
},
embed: [
"item+strings",
"item.biblio",
"item.home_library",
"item.item_type",
"item.first_hold.patron",
"item.recall.patron",
"from_library",
],
embed: ["item+strings", "item.biblio", "item.home_library", "item.item_type", "item.first_hold.patron", "item.recall.patron", "from_library"],
order: [[1, "asc"]],
columns: [
{