Bugzilla – Attachment 137988 Details for
Bug 31202
Koha removes optional SIP fields with a value of "0"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31202: Don't remove optional SIP fields with a value of "0"
Bug-31202-Dont-remove-optional-SIP-fields-with-a-v.patch (text/plain), 2.08 KB, created by
Joonas Kylmälä
on 2022-07-21 16:22:32 UTC
(
hide
)
Description:
Bug 31202: Don't remove optional SIP fields with a value of "0"
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2022-07-21 16:22:32 UTC
Size:
2.08 KB
patch
obsolete
>From 8251105114b5cf8cdf7694307f4d3740d018baa0 Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Wed, 20 Jul 2022 12:32:58 -0400 >Subject: [PATCH] Bug 31202: Don't remove optional SIP fields with a value of > "0" >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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> >--- > C4/SIP/Sip.pm | 5 ++++- > t/db_dependent/SIP/Message.t | 5 ++++- > 2 files changed, 8 insertions(+), 2 deletions(-) > >diff --git a/C4/SIP/Sip.pm b/C4/SIP/Sip.pm >index bd834f2447..4d662a26b7 100644 >--- a/C4/SIP/Sip.pm >+++ b/C4/SIP/Sip.pm >@@ -108,7 +108,10 @@ sub maybe_add { > $value =~ s/$regex->{find}/$regex->{replace}/g; > } > } >- return (defined($value) && $value) ? add_field($fid, $value) : ''; >+ >+ return ( defined($value) && length($value) ) >+ ? add_field( $fid, $value ) >+ : ''; > } > > # >diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t >index 162edfb6d6..fc0e11944b 100755 >--- a/t/db_dependent/SIP/Message.t >+++ b/t/db_dependent/SIP/Message.t >@@ -115,7 +115,7 @@ subtest 'Test hold_patron_bcode' => sub { > > subtest 'hold_patron_name() tests' => sub { > >- plan tests => 2; >+ plan tests => 3; > > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >@@ -145,6 +145,9 @@ subtest 'hold_patron_name() tests' => sub { > my $resp = C4::SIP::Sip::maybe_add( FID_CALL_NUMBER, $sip_item->hold_patron_name, $server ); > is( $resp, q{}, "maybe_add returns empty string for SIP item with no hold returns empty string" ); > >+ $resp = C4::SIP::Sip::maybe_add( FID_CALL_NUMBER, "0", $server ); >+ is( $resp, q{CS0|}, "maybe_add will create the field of the string '0'" ); >+ > $schema->storage->txn_rollback; > }; > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31202
:
137941
|
137947
| 137988