From b4cbe4da6955ee3f8ff9fdfd4a82d3f78ffcb376 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 16 May 2023 16:16:44 -0300 Subject: [PATCH] Bug 23336: (QA follow-up) Some minor fixes This patch deals with some QA script warnings, and also makes some changes in line with bug 33556. Signed-off-by: Tomas Cohen Arazi --- Koha/REST/V1/Checkouts.pm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Koha/REST/V1/Checkouts.pm b/Koha/REST/V1/Checkouts.pm index 7997941b3cb..d9650eb1b72 100644 --- a/Koha/REST/V1/Checkouts.pm +++ b/Koha/REST/V1/Checkouts.pm @@ -111,10 +111,10 @@ Controller function that handles retrieval of Checkout availability sub get_availability { my $c = shift->openapi->valid_input or return; - my $patron = Koha::Patrons->find( $c->validation->param('patron_id') ); + my $patron = Koha::Patrons->find( $c->param('patron_id') ); my $inprocess = 0; # What does this do? my $ignore_reserves = 0; # Don't ignore reserves - my $item = Koha::Items->find( $c->validation->param('item_id') ); + my $item = Koha::Items->find( $c->param('item_id') ); my $params = { item => $item }; @@ -123,9 +123,8 @@ sub get_availability { C4::Circulation::CanBookBeIssued( $patron, undef, undef, $inprocess, $ignore_reserves, $params ); - my $confirm_keys = join( /:/, sort keys %{$confirmation} ); - my $tokenizer = Koha::Token->new; - my $token = $tokenizer->generate_jwt({ id => $confirm_keys }); + my $confirm_keys = join( ":", sort keys %{$confirmation} ); + my $token = Koha::Token->new->generate_jwt({ id => $confirm_keys }); my $response = { blockers => $impossible, @@ -146,7 +145,7 @@ Add a new checkout sub add { my $c = shift->openapi->valid_input or return; - my $body = $c->validation->param('body'); + my $body = $c->req->json; my $item_id = $body->{item_id}; my $patron_id = $body->{patron_id}; my $onsite = $body->{onsite_checkout}; @@ -205,10 +204,9 @@ sub add { # Check for existance of confirmation token # and if exists check validity - if ( my $token = $c->validation->param('confirmation') ) { - my $confirm_keys = join( /:/, sort keys %{$confirmation} ); - my $tokenizer = Koha::Token->new; - $confirmed = $tokenizer->check_jwt( + if ( my $token = $c->param('confirmation') ) { + my $confirm_keys = join( ":", sort keys %{$confirmation} ); + $confirmed = Koha::Token->new->check_jwt( { id => $confirm_keys, token => $token } ); } -- 2.40.1