View | Details | Raw Unified | Return to bug 34324
Collapse All | Expand All

(-)a/Koha/REST/V1/Tickets.pm (+10 lines)
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(
(-)a/Koha/Ticket.pm (-1 / +1 lines)
Lines 17-23 package Koha::Ticket; Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use base qw(Koha::Object);
20
use base qw(Koha::Object Koha::Object::Mixin::AdditionalFields);
21
21
22
use C4::Letters;
22
use C4::Letters;
23
23
(-)a/api/v1/swagger/definitions/ticket.yaml (+7 lines)
Lines 9-14 properties: Link Here
9
    type: string
9
    type: string
10
    enum:
10
    enum:
11
      - catalog
11
      - catalog
12
      - opac_problem
12
  reported_date:
13
  reported_date:
13
    type:
14
    type:
14
      - string
15
      - string
Lines 76-81 properties: Link Here
76
      - integer
77
      - integer
77
      - "null"
78
      - "null"
78
    description: Number of updates
79
    description: Number of updates
80
  extended_attributes:
81
    type:
82
      - array
83
    items:
84
      $ref: additional_field_value.yaml
85
    description: Related additional field values
79
  _strings:
86
  _strings:
80
    type:
87
    type:
81
      - object
88
      - object
(-)a/api/v1/swagger/paths/tickets.yaml (-1 / +1 lines)
Lines 30-35 Link Here
30
            - biblio
30
            - biblio
31
            - updates+count
31
            - updates+count
32
            - +strings
32
            - +strings
33
            - extended_attributes
33
        collectionFormat: csv
34
        collectionFormat: csv
34
    responses:
35
    responses:
35
      "200":
36
      "200":
36
- 

Return to bug 34324