From 4554340b7c82cb8c027228b22c41cfd2977935ac Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Tue, 11 Aug 2020 17:01:09 +0200 Subject: [PATCH] Add warning no staff online for converted ticket --- .../controllers/subsystem/tickets/mentor_tickets.dm | 1 + code/controllers/subsystem/tickets/tickets.dm | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/code/controllers/subsystem/tickets/mentor_tickets.dm b/code/controllers/subsystem/tickets/mentor_tickets.dm index bf27a0f3144..af4ea2e914d 100644 --- a/code/controllers/subsystem/tickets/mentor_tickets.dm +++ b/code/controllers/subsystem/tickets/mentor_tickets.dm @@ -11,6 +11,7 @@ GLOBAL_REAL(SSmentor_tickets, /datum/controller/subsystem/tickets/mentor_tickets ticket_name = "Mentor Ticket" span_class = "mentorhelp" other_ticket_name = "Admin" + other_ticket_permission = R_ADMIN close_rights = R_MENTOR | R_ADMIN rights_needed = R_MENTOR | R_ADMIN | R_MOD diff --git a/code/controllers/subsystem/tickets/tickets.dm b/code/controllers/subsystem/tickets/tickets.dm index 95fa22c936c..e4883c39c7d 100644 --- a/code/controllers/subsystem/tickets/tickets.dm +++ b/code/controllers/subsystem/tickets/tickets.dm @@ -23,7 +23,11 @@ SUBSYSTEM_DEF(tickets) var/ticket_name = "Admin Ticket" var/close_rights = R_ADMIN var/rights_needed = R_ADMIN | R_MOD + + /// The name of the other ticket type to convert to var/other_ticket_name = "Mentor" + /// Which permission to look for when seeing if there is staff available for the other ticket type + var/other_ticket_permission = R_MENTOR var/list/close_messages var/list/allTickets = list() //make it here because someone might ahelp before the system has initialized @@ -120,9 +124,18 @@ SUBSYSTEM_DEF(tickets) return if(alert("Are you sure to convert this ticket to an '[other_ticket_name]' ticket?",,"Yes","No") != "Yes") return + if(!other_ticket_system_staff_check()) + return var/datum/ticket/T = allTickets[ticketId] convert_ticket(T) +/datum/controller/subsystem/tickets/proc/other_ticket_system_staff_check() + var/list/staff = staff_countup(other_ticket_permission) + if(!staff[1]) + if(alert("No active staff online to answer the ticket. Are you sure you want to convert the ticket?",, "No", "Yes") != "Yes") + return FALSE + return TRUE + /datum/controller/subsystem/tickets/proc/convert_ticket(datum/ticket/T) T.ticketState = TICKET_CLOSED var/client/C = usr.client