Lines 87-97
sub add {
Link Here
|
87 |
|
87 |
|
88 |
my $user_roles = delete $body->{user_roles} // []; |
88 |
my $user_roles = delete $body->{user_roles} // []; |
89 |
my $documents = delete $body->{documents} // []; |
89 |
my $documents = delete $body->{documents} // []; |
|
|
90 |
my $extended_attributes = delete $body->{extended_attributes} // []; |
90 |
|
91 |
|
91 |
my $license = Koha::ERM::License->new_from_api($body)->store; |
92 |
my $license = Koha::ERM::License->new_from_api($body)->store; |
92 |
$license->user_roles($user_roles); |
93 |
$license->user_roles($user_roles); |
93 |
$license->documents($documents); |
94 |
$license->documents($documents); |
94 |
|
95 |
|
|
|
96 |
my @extended_attributes = map { {'id' => $_->{field_id}, 'value' => $_->{value}} } @{$extended_attributes}; |
97 |
$license->extended_attributes( \@extended_attributes ); |
98 |
|
95 |
$c->res->headers->location($c->req->url->to_string . '/' . $license->license_id); |
99 |
$c->res->headers->location($c->req->url->to_string . '/' . $license->license_id); |
96 |
return $c->render( |
100 |
return $c->render( |
97 |
status => 201, |
101 |
status => 201, |
Lines 165-175
sub update {
Link Here
|
165 |
|
169 |
|
166 |
my $user_roles = delete $body->{user_roles} // []; |
170 |
my $user_roles = delete $body->{user_roles} // []; |
167 |
my $documents = delete $body->{documents} // []; |
171 |
my $documents = delete $body->{documents} // []; |
|
|
172 |
my $extended_attributes = delete $body->{extended_attributes} // []; |
168 |
|
173 |
|
169 |
$license->set_from_api($body)->store; |
174 |
$license->set_from_api($body)->store; |
170 |
$license->user_roles($user_roles); |
175 |
$license->user_roles($user_roles); |
171 |
$license->documents($documents); |
176 |
$license->documents($documents); |
172 |
|
177 |
|
|
|
178 |
my @extended_attributes = map { {'id' => $_->{field_id}, 'value' => $_->{value}} } @{$extended_attributes}; |
179 |
$license->extended_attributes( \@extended_attributes ); |
180 |
|
173 |
$c->res->headers->location($c->req->url->to_string . '/' . $license->license_id); |
181 |
$c->res->headers->location($c->req->url->to_string . '/' . $license->license_id); |
174 |
return $c->render( |
182 |
return $c->render( |
175 |
status => 200, |
183 |
status => 200, |