From 03df1f329e165f4ffb6a8c2bd3e06f8a51845aae Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 21 Dec 2023 15:58:41 +0000 Subject: [PATCH] Bug 35628: Add resolution states to Catalog concerns This patch adds ticket status to the catalog concerns feature. It allows libraries to define a list of 'TICKET_STATUS' authorized values from which librarians can then pick at the point of updateing a catalog concern. To test: 1) Apply the patches and run the database updates 2) Enable catalog concerns (staff or opac will do the trick) 3) Submit a catalog concern 4) Confirm that you can still update a concern from the catalog concerns management page as before. 5) Add some values to the new TICKET_STATUS authorized values 6) Submit a new catalog concern 7) Confirm that the 'Update' button in the management modal is now a split button with a dropdown containing the list of status values defined above. Signed-off-by: Esther Melander Signed-off-by: Ray Delahunty --- Koha/REST/V1/Tickets.pm | 6 ++++++ .../en/includes/modals/display_ticket.inc | 21 ++++++++++++++++++- .../prog/en/modules/cataloguing/concerns.tt | 8 +++++-- .../prog/js/modals/display_ticket.js | 13 ++++++++---- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/Koha/REST/V1/Tickets.pm b/Koha/REST/V1/Tickets.pm index b42cee64129..52914723cba 100644 --- a/Koha/REST/V1/Tickets.pm +++ b/Koha/REST/V1/Tickets.pm @@ -220,6 +220,12 @@ sub add_update { )->store; } + # Update ticket status if needed + if ( $ticket_update->{status} ) { + my $ticket = $update->ticket; + $ticket->set( { status => $ticket_update->{status} } )->store; + } + # Optionally add to message_queue here to notify reporter if ( $update->public ) { my $notice = diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc index 3bf471ae4fa..29c258d21b7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc @@ -1,3 +1,5 @@ +[% USE AuthorisedValues %] +[% SET status = AuthorisedValues.GetAuthValueDropbox('TICKET_STATUS') %] 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 eeae5a31d6b..98f638106b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt @@ -156,7 +156,7 @@ "orderable": true }, { - "data": "resolver.firstname:resolver.surname:resolved_date", + "data": "resolver.firstname:resolver.surname:resolved_date:status", "render": function(data, type, row, meta) { let result = ''; if (row.resolved_date) { @@ -166,7 +166,11 @@ }) + ''; result += '' + $datetime(row.resolved_date) + ''; } else { - result += _("Open"); + if (row.status) { + result += row.status; + } else { + result += _("Open"); + } } return result; }, 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 b35a3a7557e..afb0d8909d2 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js +++ b/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js @@ -51,6 +51,9 @@ $(document).ready(function() { display_cardnumber: false, url: true }) + ' (' + $datetime(item.date) + ')'; + if ( item.status ) { + updates += '' + item.status + '' + } updates += ''; }); updates_display.html(updates); @@ -63,12 +66,14 @@ $(document).ready(function() { $('#public').prop( "checked", false ); }); - $('#ticketDetailsModal').on('click', '#updateTicket', function(e) { + $('#ticketDetailsModal').on('click', '.updateSubmit', function(e) { + let clicked = $(this); let ticket_id = $('#ticket_id').val(); let params = { 'public': $('#public').is(":checked"), - message: $('#update_message').val(), - user_id: logged_in_user_borrowernumber + 'message': $('#update_message').val(), + 'user_id': logged_in_user_borrowernumber, + 'status': clicked.data('status') }; $('#comment-spinner').show(); @@ -96,7 +101,7 @@ $(document).ready(function() { 'public': $('#public').is(":checked"), message: $('#update_message').val(), user_id: logged_in_user_borrowernumber, - state: 'resolved' + state: 'resolved', }; $('#resolve-spinner').show(); -- 2.44.0