From fb39f12a4de4d9ebcd8eb9159ac3f61694049e30 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 12 Feb 2025 17:23:14 +0000 Subject: [PATCH] Bug 39112: Fix item search results error This patch updates the template which generates item search JSON (for use by the DataTable) to add a 'collapse' FILTER around it. This eliminates whitespace which causes the JSON to be invalid. To test, apply the patch and perform an item search in the staff interface. It should return results without error. Sponsored-by: Athens County Public Libraries Signed-off-by: Caroline Cyr La Rose Signed-off-by: Jonathan Druart --- .../prog/en/modules/catalogue/itemsearch_json.tt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch_json.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch_json.tt index 90b677a3ed7..bb39b1b3c77 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch_json.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch_json.tt @@ -1,6 +1,8 @@ -{ "draw": [% draw | html %], "recordsTotal": [% total_rows | html %], "recordsFiltered": [% total_rows | html %], "data": [ -[%- FOREACH item IN results -%] - [%- INCLUDE 'catalogue/itemsearch_item.json.inc' item = item, user = user -%] - [%- UNLESS loop.last %],[% END -%] -[%- END -%] -] } +[% FILTER collapse %] + { "draw": [% draw | html %], "recordsTotal": [% total_rows | html %], "recordsFiltered": [% total_rows | html %], "data": [ + [% FOREACH item IN results %] + [% INCLUDE 'catalogue/itemsearch_item.json.inc' item = item, user = user %] + [% UNLESS loop.last %],[% END %] + [% END %] + ] } +[% END %] -- 2.34.1