From eeaa523218e5446aa7303c1efd61cd67ccc51f36 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 12 Dec 2017 11:15:34 +0000 Subject: [PATCH] Bug 19706: Fix bad json formed when there are no CCODE values To test: 1 - Delete all ccode values in your system 2 - Load the item search page 3 - View the console and note a js error 4 - Try to perform an item search to screen 5 - Internal server error ("unsupported format 'html'" in logs) 6 - Apply patch 7 - Reload page 8 - Note js error is gone 9 - Perform search to screen, success! To test there is no regression: 1 - Have some values in CCODE authorised values 2 - Ensure collection drop down on item search displays correctly 3 - Ensure item search returns results ot screen with no js errors Signed-off-by Owen Leonard Signed-off-by: David Bourgault Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens --- .../intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt index 5e02cc40c7..5b9edbec9c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt @@ -363,7 +363,11 @@ { 'type': 'text' }, { 'type': 'text' }, { 'type': 'text' }, - { 'type': 'select', 'values': [% ccodes.json %] }, + [% IF ccodes.size %] + { 'type': 'select', 'values': [% ccodes.json %] }, + [% ELSE %] + null, + [% END %] { 'type': 'text' }, { 'type': 'text' }, { 'type': 'select', 'values': [% branches.json %] }, -- 2.39.5