From 33ab6fc91cd8e7c7413271257e41bfc5eb0bbb3d Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 8 Sep 2023 13:32:43 +0000 Subject: [PATCH] Bug 30719: (QA follow-up) c->validation fixes Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- Koha/REST/V1/IllbatchStatuses.pm | 8 ++++---- Koha/REST/V1/Illbatches.pm | 8 ++++---- Koha/REST/V1/Illrequests.pm | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Koha/REST/V1/IllbatchStatuses.pm b/Koha/REST/V1/IllbatchStatuses.pm index 28d19da073..b2ed518b88 100644 --- a/Koha/REST/V1/IllbatchStatuses.pm +++ b/Koha/REST/V1/IllbatchStatuses.pm @@ -50,7 +50,7 @@ Get one batch statuses sub get { my $c = shift->openapi->valid_input; - my $status_code = $c->validation->param('illbatchstatus_code'); + my $status_code = $c->param('illbatchstatus_code'); my $status = Koha::IllbatchStatuses->find( { code => $status_code } ); @@ -76,7 +76,7 @@ Add a new batch status sub add { my $c = shift->openapi->valid_input or return; - my $body = $c->validation->param('body'); + my $body = $c->req->json; my $status = Koha::IllbatchStatus->new($body); @@ -107,7 +107,7 @@ Update a batch status sub update { my $c = shift->openapi->valid_input or return; - my $status = Koha::IllbatchStatuses->find( { code => $c->validation->param('illbatchstatus_code') } ); + my $status = Koha::IllbatchStatuses->find( { code => $c->param('illbatchstatus_code') } ); if ( not defined $status ) { return $c->render( @@ -142,7 +142,7 @@ sub delete { my $c = shift->openapi->valid_input or return; - my $status = Koha::IllbatchStatuses->find( { code => $c->validation->param('illbatchstatus_code') } ); + my $status = Koha::IllbatchStatuses->find( { code => $c->param('illbatchstatus_code') } ); if ( not defined $status ) { return $c->render( status => 404, openapi => { errors => [ { message => "ILL batch status not found" } ] } ); diff --git a/Koha/REST/V1/Illbatches.pm b/Koha/REST/V1/Illbatches.pm index 6c23a3036e..6b1fd95570 100644 --- a/Koha/REST/V1/Illbatches.pm +++ b/Koha/REST/V1/Illbatches.pm @@ -106,7 +106,7 @@ Get one batch sub get { my $c = shift->openapi->valid_input; - my $batchid = $c->validation->param('illbatch_id'); + my $batchid = $c->param('illbatch_id'); my $batch = Koha::Illbatches->find($batchid); @@ -143,7 +143,7 @@ Add a new batch sub add { my $c = shift->openapi->valid_input or return; - my $body = $c->validation->param('body'); + my $body = $c->req->json; # We receive cardnumber, so we need to look up the corresponding # borrowernumber @@ -204,7 +204,7 @@ Update a batch sub update { my $c = shift->openapi->valid_input or return; - my $batch = Koha::Illbatches->find( $c->validation->param('illbatch_id') ); + my $batch = Koha::Illbatches->find( $c->param('illbatch_id') ); if ( not defined $batch ) { return $c->render( @@ -253,7 +253,7 @@ sub delete { my $c = shift->openapi->valid_input or return; - my $batch = Koha::Illbatches->find( $c->validation->param('illbatch_id') ); + my $batch = Koha::Illbatches->find( $c->param('illbatch_id') ); if ( not defined $batch ) { return $c->render( status => 404, openapi => { error => "ILL batch not found" } ); diff --git a/Koha/REST/V1/Illrequests.pm b/Koha/REST/V1/Illrequests.pm index ffa512d802..6b8d990904 100644 --- a/Koha/REST/V1/Illrequests.pm +++ b/Koha/REST/V1/Illrequests.pm @@ -72,7 +72,7 @@ sub add { Koha::Database->new->schema->txn_do( sub { - my $body = $c->validation->param('body'); + my $body = $c->req->json; $body->{backend} = delete $body->{ill_backend_id}; $body->{borrowernumber} = delete $body->{patron_id}; $body->{branchcode} = delete $body->{library_id}; -- 2.39.5