From 4e38482d9cb2329d66c109ea3c3d83823e2316ae Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 21 Mar 2025 07:01:39 -0400 Subject: [PATCH] Bug 39407: Prevent SIP from crashing due to lack of active currency In the staff interface, in most areas of Koha that require an active currency to be defined, a large info box appears to let the user know there is no active currency defined. Our SIP code presumes an active currency and if one is not defined, any SIP messages utilizing C4::SIP::ILS::Patron will crash with no errors such that a response is never transmitted for the request. Test Plan: 1) Apply the unit test patch 2) prove t/db_dependent/SIP/Patron.t Fails! 3) Apply the second patch 4) prove t/db_dependent/SIP/Patron.t Succeeds! --- C4/SIP/ILS/Patron.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index f51cf63cbd4..a5a84b572f8 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -126,7 +126,8 @@ sub new { } # Get currency 3 chars max - my $currency = substr Koha::Acquisition::Currencies->get_active->currency, 0, 3; + my $active_currency = Koha::Acquisition::Currencies->get_active; + my $currency = $active_currency ? substr( $active_currency->currency, 0, 3 ) : q{}; my $circ_blocked = ( C4::Context->preference('OverduesBlockCirc') ne "noblock" && defined $flags->{ODUES}->{itemlist} ) ? 1 : 0; -- 2.39.5 (Apple Git-154)