From da3ccdc14379816ea849eeb56ab321d8e7db59a2 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 3 Feb 2017 11:38:53 +0000 Subject: [PATCH] Bug 18047 - JavaScript error on item search form unless LOC defined If LOC is not present, the item search form will raise a JS error: SyntaxError: expected expression, got '}' This patch fixes it by handling this specific case. Note that the "Status" column is still displayed. Test plan: Remove your LOC authorised values Go on the item search form => You will not get the JS error and the "Shelving location" bloc is no longer displayed. There is no need to display it if empty. Signed-off-by: Mark Tompsett Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- .../prog/en/modules/catalogue/itemsearch.tt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 d2b0d7fb32..e88d77452b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt @@ -293,7 +293,11 @@ { 'type': 'text' }, { 'type': 'select', 'values': [% branches.json %] }, { 'type': 'select', 'values': [% branches.json %] }, - { 'type': 'select', 'values': [% locations.json %] }, + [% IF locations.size %] + { 'type': 'select', 'values': [% locations.json %] }, + [% ELSE %] + null, + [% END %] { 'type': 'text' }, [% IF notforloans.size %] { 'type': 'select', 'values': [% notforloans.json %] }, @@ -401,11 +405,13 @@ options = branches empty_option = "All libraries" %] - [% INCLUDE form_field_select - name="location" - options = locations - empty_option = "All locations" - %] + [% IF locations.size %] + [% INCLUDE form_field_select + name="location" + options = locations + empty_option = "All locations" + %] + [% END %]
[% INCLUDE form_field_select -- 2.39.5