From d59e148879c0495f5071998d4521875e9c9022ed Mon Sep 17 00:00:00 2001 From: Jan Kissig Date: Tue, 23 Apr 2024 20:19:05 +0200 Subject: [PATCH] Bug 36676: SIP2 drops connection on unknown patron id in fee paid message When sending a fee paid message to SIP2 with an unknown patron id it will respond with an empty response followed by dropping the connection to a client. Test plan: a) perl /usr/share/koha/bin/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1 -l CPL --patron 2352900100046 -m fee_paid --fee-type FT --fee-amount 0.01 Output: Trying 'fee_paid' SEND: 3720240423 124447FT00USDBV0.01|AO|AA2352900100046|ACterm1| Use of uninitialized value $data in concatenation (.) or string at /usr/share/koha/bin/sip_cli_emulator.pl line 355, chunk 1. READ: b) apply patch c) perl /usr/share/koha/bin/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1 -l CPL --patron 2352900100046 -m fee_paid --fee-type FT --fee-amount 0.01 Output: Trying 'fee_paid' SEND: 3720240423 125602FT00USDBV0.01|AO|AA2352900100046|ACterm1| READ: 38N20240423 125602AO|AA2352900100046|AFInvalid patron barcode.| Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- C4/SIP/ILS.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index 2184f13e1b..3e77abf602 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -324,7 +324,9 @@ sub pay_fee { $trans->patron($patron = C4::SIP::ILS::Patron->new($patron_id)); if (!$patron) { $trans->screen_msg('Invalid patron barcode.'); - return $trans; + return { + status => $trans + }; } my $trans_result = $trans->pay( $patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff, $disallow_overpayment, $register_id ); my $ok = $trans_result->{ok}; -- 2.39.5