Bug 31202 - Koha removes optional SIP fields with a value of "0"
Summary: Koha removes optional SIP fields with a value of "0"
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: SIP2 (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Kyle M Hall (khall)
QA Contact: Joonas Kylmälä
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-20 16:02 UTC by Kyle M Hall (khall)
Modified: 2023-06-08 22:26 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00,21.11, 22.05.05
Circulation function:


Attachments
Bug 31202 - Koha removes optional SIP fields with a value of "0" (1.86 KB, patch)
2022-07-20 16:34 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 31202 - Koha removes optional SIP fields with a value of "0" (1.91 KB, patch)
2022-07-20 17:40 UTC, Michal Urban
Details | Diff | Splinter Review
Bug 31202: Don't remove optional SIP fields with a value of "0" (2.08 KB, patch)
2022-07-21 16:22 UTC, Joonas Kylmälä
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall (khall) 2022-07-20 16:02:41 UTC
Discovered this when trying to send the number of patron holds in a custom SIP field.

If the value of a SIP field is "0", that evaluates to false, so any calls to maybe_add with a value of "0" will not get added to the SIP response message.
Comment 1 Kyle M Hall (khall) 2022-07-20 16:34:38 UTC
Created attachment 137941 [details] [review]
Bug 31202 - Koha removes optional SIP fields with a value of "0"

If the value of a SIP field is "0", that evaluates to false, so any calls to maybe_add with a value of "0" will not get added to the SIP response message.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/SIP/Message.t
Comment 2 Michal Urban 2022-07-20 17:40:58 UTC
Created attachment 137947 [details] [review]
Bug 31202 - Koha removes optional SIP fields with a value of "0"

If the value of a SIP field is "0", that evaluates to false, so any calls to maybe_add with a value of "0" will not get added to the SIP response message.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/SIP/Message.t

Signed-off-by: Michal Urban <michalurban177@gmail.com>
Comment 3 Joonas Kylmälä 2022-07-21 16:22:32 UTC
Created attachment 137988 [details] [review]
Bug 31202: Don't remove optional SIP fields with a value of "0"

If the value of a SIP field is "0", that evaluates to false, so any calls to maybe_add with a value of "0" will not get added to the SIP response message.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/SIP/Message.t

Signed-off-by: Michal Urban <michalurban177@gmail.com>
JK: Adjust commit title

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Comment 4 Tomás Cohen Arazi (tcohen) 2022-07-21 19:05:11 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 5 Lucas Gass (lukeg) 2022-09-02 14:49:15 UTC
Backported to 22.05.x for 22.05.05
Comment 6 Arthur Suzuki 2022-09-14 12:59:24 UTC
Thanks!

Pushed to 21.11 for 21.11.12
Comment 7 Victor Grousset/tuxayo 2022-09-19 20:42:29 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document it seems, marking resolved.