From 525710df92296e7e6371cda12cd356718cc88de4 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! Signed-off-by: Owen Leonard Signed-off-by: David Bourgault --- koha-tmpl/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 5e02cc4..44d39d5 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 ccode.size %] + { 'type': 'select', 'values': [% ccodes.json %] }, + [% ELSE %] + null, + [% END %] { 'type': 'text' }, { 'type': 'text' }, { 'type': 'select', 'values': [% branches.json %] }, -- 2.7.4