Bug 31202

Summary: Koha removes optional SIP fields with a value of "0"
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: SIP2Assignee: Kyle M Hall (khall) <kyle>
Status: CLOSED FIXED QA Contact: Joonas Kylmälä <joonas.kylmala>
Severity: normal    
Priority: P5 - low CC: joonas.kylmala, lucas, michalurban177, victor
Version: Main   
Hardware: All   
OS: All   
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"
Bug 31202 - Koha removes optional SIP fields with a value of "0"
Bug 31202: Don't remove optional SIP fields with a value of "0"

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.