Lines 105-113
sub add {
Link Here
|
105 |
my $c = shift->openapi->valid_input or return; |
105 |
my $c = shift->openapi->valid_input or return; |
106 |
|
106 |
|
107 |
return try { |
107 |
return try { |
108 |
my $item_group_data = $c->validation->param('body'); |
108 |
|
|
|
109 |
my $biblio = Koha::Biblios->find( $c->param('biblio_id') ); |
110 |
return $c->render( |
111 |
status => 404, |
112 |
openapi => { error => 'Object not found' } |
113 |
) unless $biblio; |
114 |
|
115 |
my $item_group_data = $c->req->json; |
109 |
# biblio_id comes from the path |
116 |
# biblio_id comes from the path |
110 |
$item_group_data->{biblio_id} = $c->validation->param('biblio_id'); |
117 |
$item_group_data->{biblio_id} = $biblio->id; |
111 |
|
118 |
|
112 |
my $item_group = Koha::Biblio::ItemGroup->new_from_api($item_group_data); |
119 |
my $item_group = Koha::Biblio::ItemGroup->new_from_api($item_group_data); |
113 |
$item_group->store->discard_changes(); |
120 |
$item_group->store->discard_changes(); |
114 |
- |
|
|