Bug 40032 - Make SIP2 log missing active currency
Summary: Make SIP2 log missing active currency
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: SIP2 (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-30 08:37 UTC by Magnus Enger
Modified: 2025-05-30 08:52 UTC (History)
0 users

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2025-05-30 08:37:52 UTC
We just had a situation where "Patron Status Requests" were failing, because no currency was set to active. There was a warning about this in "About Koha > System information", but it would be nice if there was a warning in the SIP2 log too. 

To reproduce in KTD:

Make sure not currency is active, then:

$ telnet localhost 6001
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
9300CNterm1|COterm1|CPCPL
941
2300120250530    090947AOCPL|AAterm1|AC|ADterm1
Connection closed by foreign host.

In /var/log/koha/kohadev/sip-output.log:

[2025/05/30 08:34:28] [2336] [INFO] term1@127.0.0.1: INPUT MSG: '2300120250530    090947AOCPL|AAterm1|AC***|ADterm1' C4::SIP::Sip::siplog /kohadevbox/koha/C4/SIP/Sip.pm (319)
[2025/05/30 08:34:28] [2336] [DEBUG] term1@127.0.0.1: Sip::MsgType::new('C4::SIP::Sip::MsgType', '2300120250...', '23'): seq.no '0', protocol 2 C4::SIP::Sip::siplog /kohadevbox/koha/C4/SIP/Sip.pm (319)
[2025/05/30 08:34:28] [2336] [DEBUG] term1@127.0.0.1: Sip::MsgType::_initialize('Patron Status Request', '00120250530    090947AOCPL|AAterm1|AC***|ADterm1', 'A3A18', '21', ...) C4::SIP::Sip::siplog /kohadevbox/koha/C4/SIP/Sip.pm (319)
[2025/05/30 08:34:28] [2336] [DEBUG] term1@127.0.0.1: Debarred = undef :  C4::SIP::Sip::siplog /kohadevbox/koha/C4/SIP/Sip.pm (319)
[2025/05/30 08:34:28] [2336] [INFO] term1@127.0.0.1: raw_transport: shutting down C4::SIP::Sip::siplog /kohadevbox/koha/C4/SIP/Sip.pm (319)

Suggested solution:

In C4::SIP::ILS::Patron::new() we do this:

    # Get currency 3 chars max
    my $currency = substr Koha::Acquisition::Currencies->get_active->currency, 0, 3;

We could add a check for defined $currency and a log message if it is not defined.
Comment 1 Magnus Enger 2025-05-30 08:52:53 UTC
Sorry, it looks like we never return from this:

my $currency = substr Koha::Acquisition::Currencies->get_active->currency, 0, 3;

when no currency is set to active, so my naive suggestion won't work.