From 26733995dd2e0361e2abbea19410e5afdbfd12fb Mon Sep 17 00:00:00 2001 From: kenstir Date: Mon, 25 May 2020 22:08:33 -0400 Subject: [PATCH] Try the obvious, calling checkout directly, and it doesn't work --- .../perlmods/lib/OpenILS/Application/Selfcheck.pm | 42 +++++++++++++++++++--- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm index b640ff974a..0562938d43 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm @@ -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; -- 2.11.0