Lines 88-103
sub add {
Link Here
|
88 |
my $c = shift->openapi->valid_input or return; |
88 |
my $c = shift->openapi->valid_input or return; |
89 |
|
89 |
|
90 |
return try { |
90 |
return try { |
91 |
my $basket = Koha::Acquisition::Basket->new_from_api( $c->validation->param('body') ); |
91 |
my $basket = Koha::Acquisition::Basket->new_from_api( $c->req->json ); |
92 |
$basket->store->discard_changes; |
92 |
$basket->store; |
93 |
|
93 |
|
94 |
$c->res->headers->location( |
94 |
$c->res->headers->location( $c->req->url->to_string . '/' . $basket->basketno ); |
95 |
$c->req->url->to_string . '/' . $basket->basketno |
|
|
96 |
); |
97 |
|
95 |
|
98 |
return $c->render( |
96 |
return $c->render( |
99 |
status => 201, |
97 |
status => 201, |
100 |
openapi => $basket->to_api |
98 |
openapi => $c->objects->to_api($basket), |
101 |
); |
99 |
); |
102 |
} catch { |
100 |
} catch { |
103 |
$c->unhandled_exception($_); |
101 |
$c->unhandled_exception($_); |
104 |
- |
|
|