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>
(cherry picked from commit da3ccdc143)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
This commit is contained in:
Nick Clemens 2017-02-03 11:38:53 +00:00 committed by Katrin Fischer
parent 7e3ffc7f87
commit b441c89f4f
1 changed files with 12 additions and 6 deletions

View File

@ -292,7 +292,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 %] },
@ -391,11 +395,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