From 9b76d1a855707ca927bc7930e8d9538bb2509fe9 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 25 Oct 2022 10:24:19 -0400 Subject: [PATCH] LP1901930 Support optional ACS Resend messages Signed-off-by: Bill Erickson --- .../src/perlmods/lib/OpenILS/Application/SIP2.pm | 23 +++++++++++++++++++++- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 6 ++++++ .../src/sql/Pg/upgrade/XXXX.schema.sip-config.sql | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2.pm index c8f99b27a2..b2cf0be53c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2.pm @@ -79,13 +79,24 @@ sub dispatch_sip2_request { '37' => \&handle_payment, '63' => \&handle_patron_info, '65' => \&handle_renew_all, + '97' => \&handle_resend, 'XS' => \&handle_end_session }; return OpenILS::Event->new('SIP2_NOT_IMPLEMENTED', {payload => $message}) unless exists $MESSAGE_MAP->{$msg_code}; - return $MESSAGE_MAP->{$msg_code}->($session, $message); + my $msg = $MESSAGE_MAP->{$msg_code}->($session, $message); + + if ($msg_code ne '97' && # Don't cache the resend response + $session->config->{settings}->{support_acs_resend_messages}) { + + # If resend is supported, toss the last sent message for this + # session into the cache. + $SC->cache->put_cache("sip2_lastmsg_$seskey", $msg); + } + + return $msg; } sub handle_end_session { @@ -867,5 +878,15 @@ sub handle_end_patron_session { } } +sub handle_resend { + my ($session, $message) = @_; + my $seskey = $session->seskey; + + return OpenILS::Event->new('SIP2_NOT_IMPLEMENTED') unless + $session->config->{settings}->{support_acs_resend_messages}; + + return $SC->cache->get_cache("sip2_lastmsg_$seskey"); +} + 1; diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index c846584817..44a1a03696 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -23331,6 +23331,12 @@ VALUES ( (SELECT id FROM sip.setting WHERE name = 'checkin_hold_as_transit'), 'Checkin local holds as transits', 'sipset', 'description') +), ( + 1, 'support_acs_resend_messages', 'false', + oils_i18n_gettext( + (SELECT id FROM sip.setting WHERE name = 'support_acs_resend_messages'), + 'Support ACS Resend Messages (code 97)', + 'sipset', 'description') ); INSERT INTO sip.screen_message (key, message) VALUES ( diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql index 35b6f5b22c..c1f71e3ec4 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql @@ -160,6 +160,12 @@ VALUES ( (SELECT id FROM sip.setting WHERE name = 'checkin_hold_as_transit'), 'Checkin local holds as transits', 'sipset', 'description') +), ( + 1, 'support_acs_resend_messages', 'false', + oils_i18n_gettext( + (SELECT id FROM sip.setting WHERE name = 'support_acs_resend_messages'), + 'Support ACS Resend Messages (code 97)', + 'sipset', 'description') ); INSERT INTO sip.screen_message (key, message) VALUES ( -- 2.11.0