Assign an unassigned ticket to the first agent who replies where the client can see it, as Assign to me would, with internal notes, bulk replies and already assigned tickets left alone, and a switch under Admin Settings Tickets Assigning to turn it off (db 4.0.9)

This commit is contained in:
johnnyq
2026-11-20 22:57:39 -05:00
parent 406d0fb607
commit 74d571c029
8 changed files with 63 additions and 2 deletions

View File

@@ -74,6 +74,23 @@ function ticketChangePriority($ticket_id, $priority) {
return [true, "Priority updated from <strong>$original_priority</strong> to <strong>$priority_sql</strong>"];
}
/*
* Whether a reply the client sees, on a ticket nobody is assigned to, assigns it to
* the agent who sent it - Admin > Settings > Tickets, config_ticket_reply_assigns.
* On until database 4.0.9 adds the switch.
*/
function ticketReplyAssigns() {
global $mysqli;
static $on = null;
if ($on === null) {
$on = true;
if (version_compare(defined('CURRENT_DATABASE_VERSION') ? (string) CURRENT_DATABASE_VERSION : '0', '4.0.9', '>=')) {
$on = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT config_ticket_reply_assigns FROM settings WHERE company_id = 1"))[0] ?? 1) === 1;
}
}
return $on;
}
/*
* Assign to an agent, or to no one with 0. A New ticket that gets an agent
* becomes Open. Returns [ok, message].