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