From 70a28611760b75aea25632ace0ffeeb5598fe186 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 22 Dec 2023 16:14:40 +0000 Subject: [PATCH] Bug 35628: Display status in table appropriately --- Koha/Ticket.pm | 34 +++++++++++++++++++ api/v1/swagger/definitions/ticket.yaml | 5 +++ api/v1/swagger/paths/tickets.yaml | 1 + .../prog/en/modules/cataloguing/concerns.tt | 3 +- 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/Koha/Ticket.pm b/Koha/Ticket.pm index 83b84bc97e3..ea17e899de4 100644 --- a/Koha/Ticket.pm +++ b/Koha/Ticket.pm @@ -179,6 +179,40 @@ sub to_api_mapping { return { id => 'ticket_id', }; } +=head3 strings_map + +=cut + +sub strings_map { + my ( $self, $params ) = @_; + + my $strings = {}; + + if ( defined $self->status ) { + my $av = Koha::AuthorisedValues->search( + { + category => 'TICKET_STATUS', + authorised_value => $self->status, + } + ); + + my $status_str = + $av->count + ? $params->{public} + ? $av->next->opac_description + : $av->next->lib + : $self->status; + + $strings->{status} = { + category => 'TICKET_STATUS', + str => $status_str, + type => 'av', + }; + } + + return $strings; +} + =head3 _type =cut diff --git a/api/v1/swagger/definitions/ticket.yaml b/api/v1/swagger/definitions/ticket.yaml index e588c99515e..8699e455f43 100644 --- a/api/v1/swagger/definitions/ticket.yaml +++ b/api/v1/swagger/definitions/ticket.yaml @@ -64,6 +64,11 @@ properties: - integer - "null" description: Number of updates + _strings: + type: + - object + - "null" + description: A list of stringified coded values additionalProperties: false required: - title diff --git a/api/v1/swagger/paths/tickets.yaml b/api/v1/swagger/paths/tickets.yaml index a0d0e2a7593..f14daf72a6a 100644 --- a/api/v1/swagger/paths/tickets.yaml +++ b/api/v1/swagger/paths/tickets.yaml @@ -28,6 +28,7 @@ - resolver - biblio - updates+count + - +strings collectionFormat: csv responses: "200": diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt index a1a27cb3be2..062caff3e47 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt @@ -102,6 +102,7 @@ "resolver", "biblio", "updates+count", + "+strings" ], 'emptyTable': '
' + _("Congratulations, there are no catalog concerns.") + '
', "columnDefs": [{ @@ -166,7 +167,7 @@ result += '' + $datetime(row.resolved_date) + ''; } else { if (row.status) { - result += row.status; + result += row._strings.status ? escape_str(row._strings.status.str) : ""; } else { result += _("Open"); } -- 2.43.0