Bug 23847: Fix custom item search fields if subfield is '0'
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 21 Oct 2019 07:37:25 +0000 (09:37 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 8 Nov 2019 12:55:39 +0000 (12:55 +0000)
The subfield is not used if is false, so if 0. We want to test if the
subfield is defined and not an empty string.

Test plan:
- Define a new custom item search fields using a subfield '0'
(withdrawn=952$0 for instance)
- Define one which does not have a subfield (control field)
- Search items using those newly created fields.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt

index 8c9a625..ee1b43e 100644 (file)
@@ -74,7 +74,7 @@
         <optgroup label="Custom search fields">
           [% FOREACH field IN items_search_fields %]
             [% marcfield = field.tagfield %]
-            [% IF field.tagsubfield %]
+            [% IF field.tagsubfield.defined AND field.tagsubfield != "" %]
               [% marcfield = marcfield _ '$' _ field.tagsubfield %]
             [% END %]
             <option value="marc:[% marcfield | html %]" data-authorised-values-category="[% field.authorised_values_category | html %]">[% field.label | html %] ([% marcfield | html %])</option>