Create skeleton service cribbed from curbside
authorkenstir <kenstir@gmail.com>
Sun, 24 May 2020 20:23:50 +0000 (16:23 -0400)
committerkenstir <kenstir@gmail.com>
Sun, 24 May 2020 20:23:50 +0000 (16:23 -0400)
Open-ILS/examples/opensrf.xml.example
Open-ILS/src/extras/ils_events.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.selfcheck.sql [new file with mode: 0644]

index eb875b1..9cde0d7 100644 (file)
@@ -1270,6 +1270,26 @@ vim:et:ts=4:sw=4:
                   <request_timeout>60</request_timeout>
                 </app_settings>
             </open-ils.ebook_api>
+
+            <open-ils.selfcheck>
+                <keepalive>5</keepalive>
+                <stateless>1</stateless>
+                <language>perl</language>
+                <implementation>OpenILS::Application::Selfcheck</implementation>
+                <max_requests>1000</max_requests>
+                <unix_config>
+                    <unix_sock>selfcheck_unix.sock</unix_sock>
+                    <unix_pid>selfcheck_unix.pid</unix_pid>
+                    <unix_log>selfcheck_unix.log</unix_log>
+                    <max_requests>1000</max_requests>
+                    <min_children>1</min_children>
+                    <max_children>15</max_children>
+                    <min_spare_children>1</min_spare_children>
+                    <max_spare_children>5</max_spare_children>
+                </unix_config>
+                <app_settings>
+                </app_settings>
+            </open-ils.selfcheck>
         </apps>
     </default>
 
index 7caebc7..e1b4926 100644 (file)
        <event code='7029' textcode='MAX_AUTO_RENEWALS_REACHED'>
                <desc xml:lang="en-US">Circulation has no more auto-renewals remaining</desc>
        </event>
+       <event code='7033' textcode='SELFCHECK_NOT_ALLOWED'>
+               <desc xml:lang="en-US">Self-checkout is not enabled for this location</desc>
+       </event>
 
 
        <!-- ================================================================ -->
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm
new file mode 100644 (file)
index 0000000..ec838bf
--- /dev/null
@@ -0,0 +1,43 @@
+package OpenILS::Application::Selfcheck;
+
+use strict;
+use warnings;
+
+use POSIX qw/strftime/;
+use OpenSRF::AppSession;
+use OpenILS::Application;
+use base qw/OpenILS::Application/;
+
+use OpenILS::Utils::DateTime qw/:datetime/;
+use OpenILS::Utils::CStoreEditor qw/:funcs/;
+use OpenILS::Utils::Fieldmapper;
+use OpenILS::Application::AppUtils;
+my $U = "OpenILS::Application::AppUtils";
+
+use DateTime;
+use DateTime::Format::ISO8601;
+
+my $date_parser = DateTime::Format::ISO8601->new;
+
+use OpenSRF::Utils::Logger qw/$logger/;
+
+sub enabled {
+    return $U->is_true(
+        $U->ou_ancestor_setting_value($org, 'circ.selfcheck')
+    );
+}
+__PACKAGE__->register_method(
+    method   => "enabled",
+    api_name => "open-ils.selfcheck.enabled",
+    stream   => 1,
+    argc     => 0,
+    signature => {
+        desc => 'Check if selfcheck is enabled',
+        return => {
+            desc => 'True if enabled, false if not'
+            type => 'bool'
+        }
+    }
+);
+
+1;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.selfcheck.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.selfcheck.sql
new file mode 100644 (file)
index 0000000..e4ca032
--- /dev/null
@@ -0,0 +1,12 @@
+BEGIN;
+
+INSERT INTO config.org_unit_setting_type (name, label, grp, description, datatype)
+VALUES (
+    'circ.selfcheck',
+    'Allow patron self-check',
+    'circ',
+    'When set to TRUE patrons will have the ability to checkout items using the mobile app.',
+    'bool'
+);
+
+COMMIT;