Bug 23847

Summary: Custom item search fields don't work if subfield is 0 (e.g. Withdrawn)
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: System AdministrationAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: eb, gmcharlt, hc, jonathan.druart, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00
Attachments: Bug 23847: Fix custom item search fields if subfield is '0'
Bug 23847: Fix custom item search fields if subfield is '0'
Bug 23847: Fix custom item search fields if subfield is '0'

Description Katrin Fischer 2019-10-21 06:16:58 UTC
When adding 952$0 Withdrawn to the custom item search fields, the search will lead to no results, even tho there are withdrawn items in the catalog.

I haven't been able to verify, but could this be related to withdrawn being a numeric value? It works well for textual fields.
Comment 1 Jonathan Druart 2019-10-21 07:37:12 UTC
It's a 0 vs undefined coding error in the template. Patch is coming.
Comment 2 Jonathan Druart 2019-10-21 07:41:52 UTC
Created attachment 94423 [details] [review]
Bug 23847: Fix custom item search fields if subfield is '0'

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.
Comment 3 Katrin Fischer 2019-10-21 07:50:29 UTC
Thx Jonathan!
Comment 4 Katrin Fischer 2019-11-03 21:56:38 UTC
Created attachment 94983 [details] [review]
Bug 23847: Fix custom item search fields if subfield is '0'

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>
Comment 5 Marcel de Rooy 2019-11-08 11:01:20 UTC
Confusing title and test plan.
Just figured out how to reproduce by searching on withdrawn in the box below instead of the withdrawn field above it.
Comment 6 Marcel de Rooy 2019-11-08 11:02:19 UTC
Created attachment 95194 [details] [review]
Bug 23847: Fix custom item search fields if subfield is '0'

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>
Comment 7 Martin Renvoize 2019-11-08 12:56:55 UTC
Nice work!

Pushed to master for 19.11.00