Bug 42278: (QA follow-up) Fix HIGHHOLDS to JSON serialisation

Using Koha::Template::Plugin::To to serialize HIGHHOLDS to JSON led to the following error:  Template process failed: undef error - encountered object '2026-05-31T23:59:00', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) at /kohadevbox/koha/Koha/Template/Plugin/To.pm line 32.
This patch fixes the handling of HIGHHOLDS.

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Jan Kissig 2026-05-29 10:58:00 +00:00 committed by Pedro Amorim
parent e0aee23fc1
commit f7941aee28
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 3 additions and 2 deletions

View File

@ -1170,7 +1170,8 @@
const today_due_date_and_time = "[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]";
const duedatespec = "[% duedatespec | html %]";
const override_high_holds = [% override_high_holds ? 1 : 0 | html %];
const HIGHHOLDS = [% HIGHHOLDS ? To.json(HIGHHOLDS) : 'null' | $raw %];
const HIGHHOLDS = [% HIGHHOLDS ? 1 : 0 | html %];
const HIGHHOLDS_returndate = "[% HIGHHOLDS.returndate | $KohaDates %]";
const waiting_holds_barcodes = new Array();
[% FOREACH wh IN waiting_holds %]
waiting_holds_barcodes.push("[% wh.item.barcode | html %]");
@ -1286,7 +1287,7 @@
if (HIGHHOLDS) {
if (!override_high_holds) {
$("input[name=duedatespec]:hidden").val(HIGHHOLDS.returndate);
$("input[name=duedatespec]:hidden").val(HIGHHOLDS_returndate);
if (duedatespec === "") {
$("input[name=restoreduedatespec]:hidden").val("highholds_empty");
} else {