From: kenstir Date: Wed, 4 Nov 2020 00:42:15 +0000 (+0000) Subject: Tried a couple of varieties of checkout as staff, not working X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=38b4a295f80c6bcedfde5c58a1a582af5cf9ce03;p=working%2FEvergreen.git Tried a couple of varieties of checkout as staff, not working Suggestions I got during hackaway: * try .override * put selfcheck logic into normal checkout flow, as is done with renew (i.e. a user can renew their own items without special permissions) --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm index 0562938d43..8b8c7e661a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Selfcheck.pm @@ -30,6 +30,8 @@ sub child_init { $logger->info("child_init: kcxxx:$kcxxx"); } +#---------------------------------------------------------------------- + sub exists { return 1; } @@ -46,6 +48,8 @@ __PACKAGE__->register_method( } ); +#---------------------------------------------------------------------- + sub xyzzy { my ($self, $conn, $authtoken, $id) = @_; @@ -54,13 +58,13 @@ sub xyzzy { my $org = $e->requestor->ws_ou; $logger->info("org:$org"); - $logger->info("e:".Dumper($e)); + #$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 $org; + return {"org" => $e->requestor->ws_ou, "patronid" => $e->requestor->id}; } __PACKAGE__->register_method( method => "xyzzy", @@ -70,10 +74,14 @@ __PACKAGE__->register_method( {type => 'string', desc => 'Authentication token'}, {type => 'number', desc => 'ID'}, ], - return => { desc => 'Test junk' } + return => { + desc => 'Test junk' + } } ); +#---------------------------------------------------------------------- + sub checkout { my ($self, $conn, $authtoken, $barcode) = @_; @@ -87,7 +95,7 @@ sub checkout { my $r = $U->simplereq( 'open-ils.circ', - 'open-ils.circ.checkout', + 'open-ils.circ.checkout.full', $authtoken, { barcode => $barcode, patron => $e->requestor->id }); @@ -95,7 +103,43 @@ sub checkout { } __PACKAGE__->register_method( method => "checkout", - api_name => "open-ils.selfcheck.checkout", + api_name => "open-ils.selfcheck.checkout.override", + signature => { + params => [ + {type => 'string', desc => 'Authentication token'}, + {type => 'string', desc => 'barcode'}, + ], + return => { desc => 'Checkout item by barcode' } + } +); + +#---------------------------------------------------------------------- + +sub checkout2 { + 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 $circ_sess = OpenSRF::AppSession->connect('open-ils.circ'); + my $req = $circ_sess->request( + 'open-ils.circ.checkout.full.override', + $authtoken, + { barcode => $barcode, patron => $e->requestor->id }); + + $conn->respond($req->gather(1)); + $circ_sess->disconnect; + + return; +} +__PACKAGE__->register_method( + method => "checkout2", + api_name => "open-ils.selfcheck.checkout2", signature => { params => [ {type => 'string', desc => 'Authentication token'},