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

(-)a/Koha/Ticket.pm (+34 lines)
Lines 179-184 sub to_api_mapping { Link Here
179
    return { id => 'ticket_id', };
179
    return { id => 'ticket_id', };
180
}
180
}
181
181
182
=head3 strings_map
183
184
=cut
185
186
sub strings_map {
187
    my ( $self, $params ) = @_;
188
189
    my $strings = {};
190
191
    if ( defined $self->status ) {
192
        my $av = Koha::AuthorisedValues->search(
193
            {
194
                category         => 'TICKET_STATUS',
195
                authorised_value => $self->status,
196
            }
197
        );
198
199
        my $status_str =
200
              $av->count
201
            ? $params->{public}
202
                ? $av->next->opac_description
203
                : $av->next->lib
204
            : $self->status;
205
206
        $strings->{status} = {
207
            category => 'TICKET_STATUS',
208
            str      => $status_str,
209
            type     => 'av',
210
        };
211
    }
212
213
    return $strings;
214
}
215
182
=head3 _type
216
=head3 _type
183
217
184
=cut
218
=cut
(-)a/Koha/Ticket/Update.pm (+34 lines)
Lines 68-73 sub to_api_mapping { Link Here
68
    return { id => 'update_id', };
68
    return { id => 'update_id', };
69
}
69
}
70
70
71
=head3 strings_map
72
73
=cut
74
75
sub strings_map {
76
    my ( $self, $params ) = @_;
77
78
    my $strings = {};
79
80
    if ( defined $self->status ) {
81
        my $av = Koha::AuthorisedValues->search(
82
            {
83
                category         => 'TICKET_STATUS',
84
                authorised_value => $self->status,
85
            }
86
        );
87
88
        my $status_str =
89
              $av->count
90
            ? $params->{public}
91
                ? $av->next->opac_description
92
                : $av->next->lib
93
            : $self->status;
94
95
        $strings->{status} = {
96
            category => 'TICKET_STATUS',
97
            str      => $status_str,
98
            type     => 'av',
99
        };
100
    }
101
102
    return $strings;
103
}
104
71
=head3 _type
105
=head3 _type
72
106
73
=cut
107
=cut
(-)a/api/v1/swagger/definitions/ticket.yaml (+5 lines)
Lines 64-69 properties: Link Here
64
      - integer
64
      - integer
65
      - "null"
65
      - "null"
66
    description: Number of updates
66
    description: Number of updates
67
  _strings:
68
    type:
69
      - object
70
      - "null"
71
    description: A list of stringified coded values
67
additionalProperties: false
72
additionalProperties: false
68
required:
73
required:
69
  - title
74
  - title
(-)a/api/v1/swagger/paths/tickets.yaml (+2 lines)
Lines 28-33 Link Here
28
            - resolver
28
            - resolver
29
            - biblio
29
            - biblio
30
            - updates+count
30
            - updates+count
31
            - +strings
31
        collectionFormat: csv
32
        collectionFormat: csv
32
    responses:
33
    responses:
33
      "200":
34
      "200":
Lines 237-242 Link Here
237
          type: string
238
          type: string
238
          enum:
239
          enum:
239
            - user
240
            - user
241
            - +strings
240
        collectionFormat: csv
242
        collectionFormat: csv
241
    responses:
243
    responses:
242
      "200":
244
      "200":
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt (-1 / +2 lines)
Lines 101-106 Link Here
101
                    "resolver",
101
                    "resolver",
102
                    "biblio",
102
                    "biblio",
103
                    "updates+count",
103
                    "updates+count",
104
                    "+strings"
104
                ],
105
                ],
105
                'emptyTable': '<div class="dialog message">' + _("Congratulations, there are no catalog concerns.") + '</div>',
106
                'emptyTable': '<div class="dialog message">' + _("Congratulations, there are no catalog concerns.") + '</div>',
106
                "columnDefs": [{
107
                "columnDefs": [{
Lines 165-171 Link Here
165
                                result += '<span class="clearfix">' + $datetime(row.resolved_date) + '</span>';
166
                                result += '<span class="clearfix">' + $datetime(row.resolved_date) + '</span>';
166
                            } else {
167
                            } else {
167
                                if (row.status) {
168
                                if (row.status) {
168
                                    result += row.status;
169
                                    result += row._strings.status ? escape_str(row._strings.status.str) : "";
169
                                } else {
170
                                } else {
170
                                    result += _("Open");
171
                                    result += _("Open");
171
                                }
172
                                }
(-)a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js (-4 / +6 lines)
Lines 32-38 $(document).ready(function() { Link Here
32
            url: "/api/v1/tickets/" + ticket_id + "/updates",
32
            url: "/api/v1/tickets/" + ticket_id + "/updates",
33
            method: "GET",
33
            method: "GET",
34
            headers: {
34
            headers: {
35
                "x-koha-embed": "user"
35
                "x-koha-embed": [ "user", "+strings" ]
36
            },
36
            },
37
        }).success(function(data) {
37
        }).success(function(data) {
38
            let updates_display = $('#concern-updates');
38
            let updates_display = $('#concern-updates');
Lines 50-59 $(document).ready(function() { Link Here
50
                updates += '<span class="clearfix">' + $patron_to_html(item.user, {
50
                updates += '<span class="clearfix">' + $patron_to_html(item.user, {
51
                    display_cardnumber: false,
51
                    display_cardnumber: false,
52
                    url: true
52
                    url: true
53
                }) + ' (' + $datetime(item.date) + ')</span>';
53
                }) + ' (' + $datetime(item.date) + ')';
54
                if ( item.status ) {
54
                if ( item.status ) {
55
                    updates += '<span class="pull-right">' + item.status + '</span>'
55
                    updates += '<span class="wrapfix pull-right">';
56
                    updates += item._strings.status ? escape_str(item._strings.status.str) : "";
57
                    updates += '</span>'
56
                }
58
                }
59
                updates += '</span>';
57
                updates += '</div>';
60
                updates += '</div>';
58
            });
61
            });
59
            updates_display.html(updates);
62
            updates_display.html(updates);
60
- 

Return to bug 35628