Bug 23847 - Custom item search fields don't work if subfield is 0 (e.g. Withdrawn)
Summary: Custom item search fields don't work if subfield is 0 (e.g. Withdrawn)
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-21 06:16 UTC by Katrin Fischer
Modified: 2021-06-14 21:29 UTC (History)
5 users (show)

See Also:
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' (1.57 KB, patch)
2019-10-21 07:41 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 23847: Fix custom item search fields if subfield is '0' (1.62 KB, patch)
2019-11-03 21:56 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 23847: Fix custom item search fields if subfield is '0' (1.72 KB, patch)
2019-11-08 11:02 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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