Lines 91-101
sub add {
Link Here
|
91 |
|
91 |
|
92 |
my $user_roles = delete $body->{user_roles} // []; |
92 |
my $user_roles = delete $body->{user_roles} // []; |
93 |
my $documents = delete $body->{documents} // []; |
93 |
my $documents = delete $body->{documents} // []; |
|
|
94 |
my $extended_attributes = delete $body->{extended_attributes} // []; |
94 |
|
95 |
|
95 |
my $license = Koha::ERM::License->new_from_api($body)->store; |
96 |
my $license = Koha::ERM::License->new_from_api($body)->store; |
96 |
$license->user_roles($user_roles); |
97 |
$license->user_roles($user_roles); |
97 |
$license->documents($documents); |
98 |
$license->documents($documents); |
98 |
|
99 |
|
|
|
100 |
my @extended_attributes = map { {'id' => $_->{field_id}, 'value' => $_->{value}} } @{$extended_attributes}; |
101 |
$license->extended_attributes( \@extended_attributes ); |
102 |
|
99 |
$c->res->headers->location($c->req->url->to_string . '/' . $license->license_id); |
103 |
$c->res->headers->location($c->req->url->to_string . '/' . $license->license_id); |
100 |
return $c->render( |
104 |
return $c->render( |
101 |
status => 201, |
105 |
status => 201, |
Lines 173-183
sub update {
Link Here
|
173 |
|
177 |
|
174 |
my $user_roles = delete $body->{user_roles} // []; |
178 |
my $user_roles = delete $body->{user_roles} // []; |
175 |
my $documents = delete $body->{documents} // []; |
179 |
my $documents = delete $body->{documents} // []; |
|
|
180 |
my $extended_attributes = delete $body->{extended_attributes} // []; |
176 |
|
181 |
|
177 |
$license->set_from_api($body)->store; |
182 |
$license->set_from_api($body)->store; |
178 |
$license->user_roles($user_roles); |
183 |
$license->user_roles($user_roles); |
179 |
$license->documents($documents); |
184 |
$license->documents($documents); |
180 |
|
185 |
|
|
|
186 |
my @extended_attributes = map { {'id' => $_->{field_id}, 'value' => $_->{value}} } @{$extended_attributes}; |
187 |
$license->extended_attributes( \@extended_attributes ); |
188 |
|
181 |
$c->res->headers->location($c->req->url->to_string . '/' . $license->license_id); |
189 |
$c->res->headers->location($c->req->url->to_string . '/' . $license->license_id); |
182 |
return $c->render( |
190 |
return $c->render( |
183 |
status => 200, |
191 |
status => 200, |