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 <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2017-02-03 11:38:53 +00:00 committed by Kyle M Hall
parent 680e6ce7d1
commit da3ccdc143

View file

@ -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 %]
</fieldset>
<fieldset>
[% INCLUDE form_field_select