Bugzilla – Attachment 165555 Details for
Bug 35628
Add optional statuses to catalog concerns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35628: Display status strings instead of codes
Bug-35628-Display-status-strings-instead-of-codes.patch (text/plain), 6.29 KB, created by
Martin Renvoize (ashimema)
on 2024-04-25 14:24:46 UTC
(
hide
)
Description:
Bug 35628: Display status strings instead of codes
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-04-25 14:24:46 UTC
Size:
6.29 KB
patch
obsolete
>From 1ab4de653132b84c01720764222f7f3597164121 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 22 Dec 2023 16:14:40 +0000 >Subject: [PATCH] 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> >--- > Koha/Ticket.pm | 34 +++++++++++++++++++ > Koha/Ticket/Update.pm | 34 +++++++++++++++++++ > api/v1/swagger/definitions/ticket.yaml | 5 +++ > api/v1/swagger/paths/tickets.yaml | 2 ++ > .../prog/en/modules/cataloguing/concerns.tt | 3 +- > .../prog/js/modals/display_ticket.js | 9 +++-- > 6 files changed, 83 insertions(+), 4 deletions(-) > >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/Koha/Ticket/Update.pm b/Koha/Ticket/Update.pm >index f275a32df6f..1ad6b6577a1 100644 >--- a/Koha/Ticket/Update.pm >+++ b/Koha/Ticket/Update.pm >@@ -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 >diff --git a/api/v1/swagger/definitions/ticket.yaml b/api/v1/swagger/definitions/ticket.yaml >index bfa0e11a466..651a12a6e74 100644 >--- a/api/v1/swagger/definitions/ticket.yaml >+++ b/api/v1/swagger/definitions/ticket.yaml >@@ -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 >diff --git a/api/v1/swagger/paths/tickets.yaml b/api/v1/swagger/paths/tickets.yaml >index a0d0e2a7593..b28dc4fca01 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": >@@ -237,6 +238,7 @@ > type: string > enum: > - user >+ - +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 98f638106b1..501aef8ed4d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt >@@ -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"); > } >diff --git a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js b/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js >index afb0d8909d2..282c2d4fcea 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js >@@ -32,7 +32,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) { > let updates_display = $('#concern-updates'); >@@ -50,10 +50,13 @@ $(document).ready(function() { > updates += '<span class="clearfix">' + $patron_to_html(item.user, { > display_cardnumber: false, > url: true >- }) + ' (' + $datetime(item.date) + ')</span>'; >+ }) + ' (' + $datetime(item.date) + ')'; > 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); >-- >2.44.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35628
:
160255
|
160256
|
160257
|
160258
|
160259
|
160268
|
160269
|
160270
|
160271
|
160272
|
160273
|
160274
|
160286
|
160287
|
160288
|
160289
|
160290
|
160308
|
160309
|
160310
|
160311
|
160312
|
160313
|
160314
|
160315
|
160316
|
160317
|
160318
|
160319
|
160320
|
160329
|
160330
|
160331
|
160332
|
160333
|
160334
|
160335
|
160364
|
162500
|
164912
|
164913
|
164914
|
164915
|
164916
|
164917
|
164918
|
165551
|
165552
|
165553
|
165554
|
165555
|
165556
|
165557
|
165560
|
165561
|
165562
|
165563
|
165564
|
165599
|
165600
|
165601
|
165602
|
165603
|
165604
|
165605
|
165606
|
165607
|
165608
|
165622
|
165623
|
165624
|
165625
|
165626
|
165627
|
165628
|
165629
|
165630
|
165631
|
165770
|
165771
|
165772
|
165773
|
165774
|
165775
|
165776
|
165777
|
165778
|
165779