View | Details | Raw Unified | Return to bug 30719
Collapse All | Expand All

(-)a/Koha/REST/V1/IllbatchStatuses.pm (-4 / +4 lines)
Lines 50-56 Get one batch statuses Link Here
50
sub get {
50
sub get {
51
    my $c = shift->openapi->valid_input;
51
    my $c = shift->openapi->valid_input;
52
52
53
    my $status_code = $c->validation->param('illbatchstatus_code');
53
    my $status_code = $c->param('illbatchstatus_code');
54
54
55
    my $status = Koha::IllbatchStatuses->find( { code => $status_code } );
55
    my $status = Koha::IllbatchStatuses->find( { code => $status_code } );
56
56
Lines 76-82 Add a new batch status Link Here
76
sub add {
76
sub add {
77
    my $c = shift->openapi->valid_input or return;
77
    my $c = shift->openapi->valid_input or return;
78
78
79
    my $body = $c->validation->param('body');
79
    my $body = $c->req->json;
80
80
81
    my $status = Koha::IllbatchStatus->new($body);
81
    my $status = Koha::IllbatchStatus->new($body);
82
82
Lines 107-113 Update a batch status Link Here
107
sub update {
107
sub update {
108
    my $c = shift->openapi->valid_input or return;
108
    my $c = shift->openapi->valid_input or return;
109
109
110
    my $status = Koha::IllbatchStatuses->find( { code => $c->validation->param('illbatchstatus_code') } );
110
    my $status = Koha::IllbatchStatuses->find( { code => $c->param('illbatchstatus_code') } );
111
111
112
    if ( not defined $status ) {
112
    if ( not defined $status ) {
113
        return $c->render(
113
        return $c->render(
Lines 142-148 sub delete { Link Here
142
142
143
    my $c = shift->openapi->valid_input or return;
143
    my $c = shift->openapi->valid_input or return;
144
144
145
    my $status = Koha::IllbatchStatuses->find( { code => $c->validation->param('illbatchstatus_code') } );
145
    my $status = Koha::IllbatchStatuses->find( { code => $c->param('illbatchstatus_code') } );
146
146
147
    if ( not defined $status ) {
147
    if ( not defined $status ) {
148
        return $c->render( status => 404, openapi => { errors => [ { message => "ILL batch status not found" } ] } );
148
        return $c->render( status => 404, openapi => { errors => [ { message => "ILL batch status not found" } ] } );
(-)a/Koha/REST/V1/Illbatches.pm (-4 / +4 lines)
Lines 106-112 Get one batch Link Here
106
sub get {
106
sub get {
107
    my $c = shift->openapi->valid_input;
107
    my $c = shift->openapi->valid_input;
108
108
109
    my $batchid = $c->validation->param('illbatch_id');
109
    my $batchid = $c->param('illbatch_id');
110
110
111
    my $batch = Koha::Illbatches->find($batchid);
111
    my $batch = Koha::Illbatches->find($batchid);
112
112
Lines 143-149 Add a new batch Link Here
143
sub add {
143
sub add {
144
    my $c = shift->openapi->valid_input or return;
144
    my $c = shift->openapi->valid_input or return;
145
145
146
    my $body = $c->validation->param('body');
146
    my $body = $c->req->json;
147
147
148
    # We receive cardnumber, so we need to look up the corresponding
148
    # We receive cardnumber, so we need to look up the corresponding
149
    # borrowernumber
149
    # borrowernumber
Lines 204-210 Update a batch Link Here
204
sub update {
204
sub update {
205
    my $c = shift->openapi->valid_input or return;
205
    my $c = shift->openapi->valid_input or return;
206
206
207
    my $batch = Koha::Illbatches->find( $c->validation->param('illbatch_id') );
207
    my $batch = Koha::Illbatches->find( $c->param('illbatch_id') );
208
208
209
    if ( not defined $batch ) {
209
    if ( not defined $batch ) {
210
        return $c->render(
210
        return $c->render(
Lines 253-259 sub delete { Link Here
253
253
254
    my $c = shift->openapi->valid_input or return;
254
    my $c = shift->openapi->valid_input or return;
255
255
256
    my $batch = Koha::Illbatches->find( $c->validation->param('illbatch_id') );
256
    my $batch = Koha::Illbatches->find( $c->param('illbatch_id') );
257
257
258
    if ( not defined $batch ) {
258
    if ( not defined $batch ) {
259
        return $c->render( status => 404, openapi => { error => "ILL batch not found" } );
259
        return $c->render( status => 404, openapi => { error => "ILL batch not found" } );
(-)a/Koha/REST/V1/Illrequests.pm (-2 / +1 lines)
Lines 72-78 sub add { Link Here
72
        Koha::Database->new->schema->txn_do(
72
        Koha::Database->new->schema->txn_do(
73
            sub {
73
            sub {
74
74
75
                my $body = $c->validation->param('body');
75
                my $body = $c->req->json;
76
                $body->{backend} = delete $body->{ill_backend_id};
76
                $body->{backend} = delete $body->{ill_backend_id};
77
                $body->{borrowernumber} = delete $body->{patron_id};
77
                $body->{borrowernumber} = delete $body->{patron_id};
78
                $body->{branchcode} = delete $body->{library_id};
78
                $body->{branchcode} = delete $body->{library_id};
79
- 

Return to bug 30719