Try the obvious, calling checkout directly, and it doesn't work
authorkenstir <kenstir@gmail.com>
Tue, 26 May 2020 02:08:33 +0000 (22:08 -0400)
committerkenstir <kenstir@gmail.com>
Tue, 26 May 2020 02:08:33 +0000 (22:08 -0400)
Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm

index b640ff9..0562938 100644 (file)
@@ -22,9 +22,12 @@ my $date_parser = DateTime::Format::ISO8601->new;
 use OpenSRF::Utils::Logger qw/$logger/;
 use Data::Dumper;
 
+our $kcxxx = '';
+
 sub child_init {
     my $self = shift;
-    $logger->info("child_init: @_");
+    $kcxxx = OpenSRF::Utils::SettingsClient->new->config_value(apps => 'open-ils.selfcheck' => app_settings => 'kcxxx');
+    $logger->info("child_init: kcxxx:$kcxxx");
 }
 
 sub exists {
@@ -53,9 +56,9 @@ sub xyzzy {
     $logger->info("org:$org");
     $logger->info("e:".Dumper($e));
 
-    #return new OpenILS::Event("SELFCHECK_NOT_ALLOWED") unless ($U->is_true(
-    #    $U->ou_ancestor_setting_value($org, 'circ.selfcheck')
-    #));
+    return new OpenILS::Event("SELFCHECK_NOT_ALLOWED") unless ($U->is_true(
+        $U->ou_ancestor_setting_value($org, 'circ.selfcheck')
+    ));
 
     return $org;
 }
@@ -71,4 +74,35 @@ __PACKAGE__->register_method(
     }
 );
 
+sub checkout {
+    my ($self, $conn, $authtoken, $barcode) = @_;
+
+    my $e = new_editor(xact => 1, authtoken => $authtoken);
+    return $e->die_event unless $e->checkauth;
+
+    my $org = $e->requestor->ws_ou;
+    return new OpenILS::Event("SELFCHECK_NOT_ALLOWED") unless ($U->is_true(
+        $U->ou_ancestor_setting_value($org, 'circ.selfcheck')
+    ));
+
+    my $r = $U->simplereq(
+        'open-ils.circ',
+        'open-ils.circ.checkout',
+        $authtoken,
+        { barcode => $barcode, patron => $e->requestor->id });
+
+    return $r;
+}
+__PACKAGE__->register_method(
+    method => "checkout",
+    api_name => "open-ils.selfcheck.checkout",
+    signature => {
+        params => [
+            {type => 'string', desc => 'Authentication token'},
+            {type => 'string', desc => 'barcode'},
+        ],
+        return => { desc => 'Checkout item by barcode' }
+    }
+);
+
 1;