|
Lines 86-93
sub add {
Link Here
|
| 86 |
# FIXME: We should allow impersonation at a later date to |
86 |
# FIXME: We should allow impersonation at a later date to |
| 87 |
# allow an API user to submit on behalf of a user |
87 |
# allow an API user to submit on behalf of a user |
| 88 |
|
88 |
|
|
|
89 |
# Capture additional_fields |
| 90 |
my $extended_attributes = delete $body->{extended_attributes} // []; |
| 91 |
|
| 92 |
# Create ticket |
| 89 |
my $ticket = Koha::Ticket->new_from_api($body)->store; |
93 |
my $ticket = Koha::Ticket->new_from_api($body)->store; |
| 90 |
$ticket->discard_changes; |
94 |
$ticket->discard_changes; |
|
|
95 |
|
| 96 |
# Set additional_fields |
| 97 |
my @extended_attributes = map { {'id' => $_->{field_id}, 'value' => $_->{value}} } @{$extended_attributes}; |
| 98 |
$ticket->extended_attributes(\@extended_attributes); |
| 99 |
|
| 100 |
# Respond |
| 91 |
$c->res->headers->location( |
101 |
$c->res->headers->location( |
| 92 |
$c->req->url->to_string . '/' . $ticket->id ); |
102 |
$c->req->url->to_string . '/' . $ticket->id ); |
| 93 |
return $c->render( |
103 |
return $c->render( |