From 13176b2936f97b9d5a32d568b0596ac240ce551c 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 Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer --- 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 | 10 ++++++++- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/Koha/REST/V1/Tickets.pm b/Koha/REST/V1/Tickets.pm index 63fe386b64..17512a86d4 100644 --- a/Koha/REST/V1/Tickets.pm +++ b/Koha/REST/V1/Tickets.pm @@ -202,6 +202,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 3bf471ae4f..29c258d21b 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 eeae5a31d6..98f638106b 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 a4541bc8ca..e180144267 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js +++ b/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js @@ -66,6 +66,12 @@ $(document).ready(function () { " (" + $datetime(item.date) + ")"; + if (item.status) { + updates += + '' + + item.status + + ""; + } updates += ""; }); updates_display.html(updates); @@ -77,12 +83,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, + status: clicked.data("status"), }; $("#comment-spinner").show(); -- 2.39.2