LP1901930 Support optional ACS Resend messages
authorBill Erickson <berickxx@gmail.com>
Tue, 25 Oct 2022 14:24:19 +0000 (10:24 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 28 Nov 2022 20:00:36 +0000 (15:00 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2.pm
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql

index c8f99b2..b2cf0be 100644 (file)
@@ -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;
 
index c846584..44a1a03 100644 (file)
@@ -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 (
index 35b6f5b..c1f71e3 100644 (file)
@@ -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 (