Bug 30719: (QA follow-up) c->validation fixes
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
fc83fb3ebb
commit
33ab6fc91c
|
|
@ -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" } ] } );
|
||||
|
|
|
|||
|
|
@ -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" } );
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
|
|
|||
Loading…
Reference in New Issue