Bug 16115: Remove JS error on item search if NOT_LOAN values do not exist

If NOT_LOAN 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 NOT_LOAN authorised values
Go on the item search form
=> You will not get the JS error and the "Status" bloc is no longer
displayed. There is no need to display it if empty.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 27a4149625)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
(cherry picked from commit e0b64c0f4a)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Jonathan Druart 2017-01-21 08:48:20 +01:00 committed by Julian Maurice
parent da8f4e0aa3
commit 47cd8dac59
1 changed files with 12 additions and 6 deletions

View File

@ -292,7 +292,11 @@
{ 'type': 'select', 'values': [% branches.json %] },
{ 'type': 'select', 'values': [% locations.json %] },
{ 'type': 'text' },
{ 'type': 'select', 'values': [% notforloans.json %] },
[% IF notforloans.size %]
{ 'type': 'select', 'values': [% notforloans.json %] },
[% ELSE %]
null,
[% END %]
{ 'type': 'text' },
null
]
@ -388,11 +392,13 @@
options = ccodes
empty_option = "All collection codes"
%]
[% INCLUDE form_field_select
name="notforloan"
options = notforloans
empty_option = "All statuses"
%]
[% IF notforloans.size %]
[% INCLUDE form_field_select
name="notforloan"
options = notforloans
empty_option = "All statuses"
%]
[% END %]
</fieldset>
<fieldset>
[% INCLUDE form_field_select_text_block %]