|
Lines 90-101
sub add {
Link Here
|
| 90 |
|
90 |
|
| 91 |
my $resources = delete $body->{resources} // []; |
91 |
my $resources = delete $body->{resources} // []; |
| 92 |
my $create_linked_biblio = delete $body->{create_linked_biblio} // 0; |
92 |
my $create_linked_biblio = delete $body->{create_linked_biblio} // 0; |
|
|
93 |
my $extended_attributes = delete $body->{extended_attributes} // []; |
| 93 |
|
94 |
|
| 94 |
my $title = Koha::ERM::EHoldings::Title->new_from_api($body) |
95 |
my $title = Koha::ERM::EHoldings::Title->new_from_api($body) |
| 95 |
->store( { create_linked_biblio => $create_linked_biblio } ); |
96 |
->store( { create_linked_biblio => $create_linked_biblio } ); |
| 96 |
|
97 |
|
| 97 |
$title->resources($resources); |
98 |
$title->resources($resources); |
| 98 |
|
99 |
|
|
|
100 |
my @extended_attributes = |
| 101 |
map { { 'id' => $_->{field_id}, 'value' => $_->{value} } } @{$extended_attributes}; |
| 102 |
$title->extended_attributes( \@extended_attributes ); |
| 103 |
|
| 99 |
$c->res->headers->location( $c->req->url->to_string . '/' . $title->title_id ); |
104 |
$c->res->headers->location( $c->req->url->to_string . '/' . $title->title_id ); |
| 100 |
return $c->render( |
105 |
return $c->render( |
| 101 |
status => 201, |
106 |
status => 201, |
|
Lines 152-161
sub update {
Link Here
|
| 152 |
|
157 |
|
| 153 |
my $resources = delete $body->{resources} // []; |
158 |
my $resources = delete $body->{resources} // []; |
| 154 |
my $create_linked_biblio = delete $body->{create_linked_biblio} // 0; |
159 |
my $create_linked_biblio = delete $body->{create_linked_biblio} // 0; |
|
|
160 |
my $extended_attributes = delete $body->{extended_attributes} // []; |
| 155 |
|
161 |
|
| 156 |
$title->set_from_api($body)->store( { create_linked_biblio => $create_linked_biblio } ); |
162 |
$title->set_from_api($body)->store( { create_linked_biblio => $create_linked_biblio } ); |
| 157 |
|
163 |
|
| 158 |
$title->resources($resources); |
164 |
$title->resources($resources); |
|
|
165 |
my @extended_attributes = |
| 166 |
map { { 'id' => $_->{field_id}, 'value' => $_->{value} } } @{$extended_attributes}; |
| 167 |
$title->extended_attributes( \@extended_attributes ); |
| 159 |
|
168 |
|
| 160 |
return $c->render( |
169 |
return $c->render( |
| 161 |
status => 200, |
170 |
status => 200, |