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:
parent
13176b2936
commit
c17ab9bd75
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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":
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue