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

(-)a/Koha/REST/V1/Tickets.pm (+10 lines)
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(
(-)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 62-67 properties: Link Here
62
      - integer
63
      - integer
63
      - "null"
64
      - "null"
64
    description: Number of updates
65
    description: Number of updates
66
  extended_attributes:
67
    type:
68
      - array
69
    items:
70
      $ref: additional_field_value.yaml
71
    description: Related additional field values
65
additionalProperties: false
72
additionalProperties: false
66
required:
73
required:
67
  - source
74
  - source
(-)a/api/v1/swagger/paths/tickets.yaml (-1 / +1 lines)
Lines 28-33 Link Here
28
            - resolver
28
            - resolver
29
            - biblio
29
            - biblio
30
            - updates+count
30
            - updates+count
31
            - extended_attributes
31
        collectionFormat: csv
32
        collectionFormat: csv
32
    responses:
33
    responses:
33
      "200":
34
      "200":
34
- 

Return to bug 34324