Bug 35628: Display status strings instead of codes

Signed-off-by: Esther Melander <esther@bywatersolutions.com>
Signed-off-by: Ray Delahunty <lib-systems@arts.ac.uk>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2023-12-22 16:14:40 +00:00 committed by Katrin Fischer
parent 13176b2936
commit c17ab9bd75
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
6 changed files with 85 additions and 7 deletions

View File

@ -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

View File

@ -68,6 +68,40 @@ sub to_api_mapping {
return { id => 'update_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

View File

@ -68,6 +68,11 @@ properties:
- integer
- "null"
description: Number of updates
_strings:
type:
- object
- "null"
description: A list of stringified coded values
additionalProperties: false
required:
- source

View File

@ -28,6 +28,7 @@
- resolver
- biblio
- updates+count
- +strings
collectionFormat: csv
responses:
"200":
@ -237,6 +238,7 @@
type: string
enum:
- user
- +strings
collectionFormat: csv
responses:
"200":

View File

@ -103,6 +103,7 @@
"resolver",
"biblio",
"updates+count",
"+strings"
],
'emptyTable': '<div class="dialog message">' + _("Congratulations, there are no catalog concerns.") + '</div>',
"columnDefs": [{
@ -167,7 +168,7 @@
result += '<span class="clearfix">' + $datetime(row.resolved_date) + '</span>';
} else {
if (row.status) {
result += row.status;
result += row._strings.status ? escape_str(row._strings.status.str) : "";
} else {
result += _("Open");
}

View File

@ -33,7 +33,7 @@ $(document).ready(function () {
url: "/api/v1/tickets/" + ticket_id + "/updates",
method: "GET",
headers: {
"x-koha-embed": "user",
"x-koha-embed": ["user", "+strings"],
},
})
.success(function (data) {
@ -65,13 +65,15 @@ $(document).ready(function () {
}) +
" (" +
$datetime(item.date) +
")</span>";
")";
if (item.status) {
updates +=
'<span class="pull-right">' +
item.status +
"</span>";
updates += '<span class="wrapfix pull-right">';
updates += item._strings.status
? escape_str(item._strings.status.str)
: "";
updates += "</span>";
}
updates += "</span>";
updates += "</div>";
});
updates_display.html(updates);