Bugzilla – Attachment 101559 Details for
Bug 24966
Fix calls to maybe_add where method call does not return a value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24966: Fix calls to maybe_add where method call does not return a value
Bug-24966-Fix-calls-to-maybeadd-where-method-call-.patch (text/plain), 2.31 KB, created by
Kyle M Hall (khall)
on 2020-03-24 12:54:14 UTC
(
hide
)
Description:
Bug 24966: Fix calls to maybe_add where method call does not return a value
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-03-24 12:54:14 UTC
Size:
2.31 KB
patch
obsolete
>From e8610ef60a30f511c7ba2aa40349977ef520e8c0 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 24 Mar 2020 08:51:29 -0400 >Subject: [PATCH] Bug 24966: Fix calls to maybe_add where method call does not > return a value > >For reasons unknown to me, a call like: >-- >$resp .= maybe_add( FID_CALL_NUMBER, $item->call_number, $server ); >-- >will not work as expected if the item has no callnumber. > >One would expect the parameters to the subroutine to be: 'CY', under, and a SIPServer object. > >What is actually received is: 'CY', and a SIPServer object. > >We ingest the parameters like so: >-- >sub maybe_add { > my ($fid, $value, $server) = @_; >-- >So, what happens is $value is populated with the server object! > >This can cause bad output like this: >-- >OUTPUT MSG: '101YNN20200324 063701AOBPL|AB32503201584185|AQBPL|AJCat /|CK001|CRn|CSJ 636.8 CLU|CYC4::SIP::SIPServer=HASH(0x1ea0e58)|DAC4::SIP::SIPServer=HASH(0x1ea0e58)|' >-- > >Test Plan: >1) On master, perform a checkin of an item not on hold using the sip cli tester >2) Note some fields contain something like 'C4::SIP::SIPServer=HASH(0x1ea0e58)' >3) Apply this patch >4) Restart the SIP server >5) Perform the SIP checkin again >6) Those fields from step 2 should be gone! >--- > C4/SIP/Sip.pm | 6 ++++++ > 1 file changed, 6 insertions(+) > >diff --git a/C4/SIP/Sip.pm b/C4/SIP/Sip.pm >index a708fa148a..4eb33638fd 100644 >--- a/C4/SIP/Sip.pm >+++ b/C4/SIP/Sip.pm >@@ -60,6 +60,9 @@ sub timestamp { > sub add_field { > my ($field_id, $value, $server) = @_; > >+ # $value may be populated with the $server object if the method call did not return anything >+ ( $value, $server ) = ( $server, $value ) if ref($value) eq 'C4::SIP::SIPServer'; >+ > if ( my $hide_fields = $server->{account}->{hide_fields} ) { > my @fields = split( ',', $hide_fields ); > return q{} if first { $_ eq $field_id } @fields; >@@ -94,6 +97,9 @@ sub add_field { > sub maybe_add { > my ($fid, $value, $server) = @_; > >+ # $value may be populated with the $server object if the method call did not return anything >+ ( $value, $server ) = ( $server, $value ) if ref($value) eq 'C4::SIP::SIPServer'; >+ > if ( my $hide_fields = $server->{account}->{hide_fields} ) { > my @fields = split( ',', $hide_fields ); > return q{} if first { $_ eq $fid } @fields; >-- >2.21.1 (Apple Git-122.3)
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 24966
:
101559
|
101632
|
102584
|
102585
|
102689
|
102697
|
102698