diff --git a/CHANGELOG.md b/CHANGELOG.md
index 04457320d..923b27878 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,7 @@ This file documents all notable changes made to ITFlow.
### Upgrading to 26.12
-Update from Maintenance > Update — Queue Update hands the job to cron, which updates the files and applies this release's forty database changes (3.6.6 to 4.0.7) in the same pass. They add four tables for RMM providers and their alerts, a setting for API keys in the address, a column marking the emails the mail queue clears once sent, a column and a table for agent banners, two columns for ticket statuses with a setting for the "ticket assigned" message, a column on tickets with a setting for the "no response" message, a table for who a ticket's email replies go to, the settings for Quick tickets, columns on recurring tickets and recurring invoices for booking and making them ahead, two columns on ticket replies for when their time was worked, the settings for cron alerts, a table and a setting for labor costs, a column on users for API / service accounts, columns on tickets and recurring tickets for how long booked work takes, a column each on recurring tickets and calendar events for repeating on a weekday, three columns on agents' settings for their calendar color, what their calendar shows and their own time zone, a table for the agents helping on a ticket, three columns on quote lines with three settings for what a quote line costs and how it is priced, a column each on quote lines and products with a setting for their pictures, two settings and a column on tickets for keeping project tickets apart, a table for your other offices with a column each on agents and invites for which one they work from, three settings for the emails and notices your agents get about their tickets, three settings for sending and reading Microsoft 365 mail through Microsoft Graph, five tables, four settings and a role permission for purchase orders, five settings for switching Dispatch, Bookkeeping, Purchasing, Trips and the calendar on and off, and eight tables, three columns and two settings for the Knowledge Base, who can read its articles, what its readers think of them and their files, a column on documents for how often each is reviewed, a column on agents' settings for compact rows, a table for reply drafts, a table for which tickets each agent has opened, two columns on contacts for an email that bounces, a table for credentials' earlier passwords, a column on recurring invoices for a pause with an end, a column on calendar events, two columns on agents' settings and a table for reminders, four settings for the weekly summary, and change nothing that is there. Nothing else is required, but it is a big release, so take a backup before you update. Purchasing starts off - switch it on in Admin > Settings > Modules - and so does the Knowledge Base's public help center, in Admin > Settings > Knowledge Base. This release has thirteen security fixes - see Security. On Apache, ITFlow's own .htaccess now sends security headers: if you show ITFlow inside a frame on another website, it will now refuse to load there. On nginx, add the same headers to your server block if you want them - see Developer Updates.
+Update from Maintenance > Update — Queue Update hands the job to cron, which updates the files and applies this release's forty-one database changes (3.6.6 to 4.0.8) in the same pass. They add four tables for RMM providers and their alerts, a setting for API keys in the address, a column marking the emails the mail queue clears once sent, a column and a table for agent banners, two columns for ticket statuses with a setting for the "ticket assigned" message, a column on tickets with a setting for the "no response" message, a table for who a ticket's email replies go to, the settings for Quick tickets, columns on recurring tickets and recurring invoices for booking and making them ahead, two columns on ticket replies for when their time was worked, the settings for cron alerts, a table and a setting for labor costs, a column on users for API / service accounts, columns on tickets and recurring tickets for how long booked work takes, a column each on recurring tickets and calendar events for repeating on a weekday, three columns on agents' settings for their calendar color, what their calendar shows and their own time zone, a table for the agents helping on a ticket, three columns on quote lines with three settings for what a quote line costs and how it is priced, a column each on quote lines and products with a setting for their pictures, two settings and a column on tickets for keeping project tickets apart, a table for your other offices with a column each on agents and invites for which one they work from, three settings for the emails and notices your agents get about their tickets, three settings for sending and reading Microsoft 365 mail through Microsoft Graph, five tables, four settings and a role permission for purchase orders, five settings for switching Dispatch, Bookkeeping, Purchasing, Trips and the calendar on and off, and eight tables, three columns and two settings for the Knowledge Base, who can read its articles, what its readers think of them and their files, a column on documents for how often each is reviewed, a column on agents' settings for compact rows, a table for reply drafts, a table for which tickets each agent has opened, two columns on contacts for an email that bounces, a table for credentials' earlier passwords, a column on recurring invoices for a pause with an end, a column on calendar events, two columns on agents' settings and a table for reminders, four settings for the weekly summary and a table for related tickets, and change nothing that is there. Nothing else is required, but it is a big release, so take a backup before you update. Purchasing starts off - switch it on in Admin > Settings > Modules - and so does the Knowledge Base's public help center, in Admin > Settings > Knowledge Base. This release has thirteen security fixes - see Security. On Apache, ITFlow's own .htaccess now sends security headers: if you show ITFlow inside a frame on another website, it will now refuse to load there. On nginx, add the same headers to your server block if you want them - see Developer Updates.
### Security
@@ -105,6 +105,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u
- Calendar: Holidays, under From ITFlow, shows the closure days from Admin > SLA, and is on to start with. From Mountaineer IT's build of ITFlow.
- Calendar: what you have shown - calendars, sources, Whose and the view - is kept to your account, so the calendar opens the same way on every computer and phone. The first time, it opens on your own calendar. With Whose set to Everyone, To schedule lists everyone's open tickets that aren't booked, with who has each. From Mountaineer IT's build of ITFlow.
- Tickets: more than one agent can work a ticket. Under Assigned to on the ticket, Additional agents adds others to help, while the ticket stays assigned to its lead. Each helper is booked at the same time as the lead - moving and cancelled with the lead's booking - at a time of their own, or not booked. A helper finds the ticket under Mine and on the dashboard, is emailed the client's replies as the lead is, and is sent their own booking with a calendar file that doesn't replace the lead's. The client's emails stay about the lead's booking. Click a helper to change their booking or take them off. From Mountaineer IT's build of ITFlow.
+- Tickets: link related tickets - the same outage at several clients, or a problem that keeps coming back. Link related tickets, in a ticket's ⋮ menu, picks any client's open tickets (or ones closed in the last 90 days), and Link together on the tickets list's Bulk Action links the ones ticked. Linking a ticket to one already related to others brings it in with them all. Each ticket's Related card lists the others with their client, status and who has them; its menu has Reply to all and Resolve all for the open ones, and the × takes one out. A related ticket shows a link and how many on the tickets list, and merging a ticket passes its related tickets to the one it goes into. An agent sees only the related tickets of clients they can open, and is told how many others there are.
- Tickets: the tickets list and board show +1, +2 after the lead when others are helping - Helping when one of them is you. A helper's booking is on the calendar in their color, can be dragged to a time of their own, shows in their calendar link, and counts when someone books them for something else at the same time. From Mountaineer IT's build of ITFlow.
- Time zones: an agent who works away from the company can pick My time zone under Account > Preferences. The calendar, the ticket's booking, the Schedule window, New Event and Edit, and the event's quick look are then on their own clock, with a note saying so, and their booking emails give their time with the company's beside it. Bookings are still kept in the company's time, so the client's emails and calendar files, and everyone else's view, don't change. From Mountaineer IT's build of ITFlow.
- Dispatch: a new page under Support puts each agent's booked work beside the tickets still to give out. The queue on the left has three tabs - No agent, Not booked (with an agent, nothing booked) and Left behind - most urgent first, with a search, a client and a priority filter. Day shows a column for each agent through the day; Week a row for each agent with a column for each day. Drag a ticket from the queue onto an agent and a time, or drag a booking to another agent or time, and the Schedule window opens with the agent, the time, how long and onsite or remote filled in - Schedule it gives the ticket to that agent and books it, emailing them the calendar file, the agent who had it the cancellation, and the contact and watchers unless you switch that off. Drag a booking back onto the queue to take it off the schedule. One-off events move the same way, to another time or agent. Workload shows each agent's open tickets (leading and helping), SLAs breached or close to it, tickets past due, not booked or gone quiet, and the hours booked today and this week against the working hours in Admin > SLA - flagged Falling behind, Watch, Overloaded or Has room against the team. Click an agent for their tickets, or drop a ticket from the queue on one to give it to them. Under it, This week shows tickets in and closed each day, against last week and the last four, the week's SLA results and each agent's share. Which agents show, the view and weekends are kept to your account, and an agent on their own time zone sees it on their clock. Seeing Dispatch takes Support in your role; booking from it takes Support at Modify. From Mountaineer IT's build of ITFlow.
@@ -400,6 +401,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u
- Users: `invite_users_bulk` (`admin/post/users.php`, `admin/modals/user/user_invite_bulk.php`) - `userInviteBulkParse()` (up to `USER_INVITE_BULK_MAX`, 50) in `functions/user_invite.php`, then `userCheckIdentity()`, the seat limit, `userInviteSave()` and `userInviteSend()` for each, as `add_user` does for one.
- Tickets: `ticketMailTry($from, $subject, $auto_reply)` in `functions/ticket_mail_try.php` asks what `cron/ticket_email_parser.php` asks, in its order, with no writes - `ticketMailTryReply()` mirrors `addReply()`. Kept in step with the parser by hand. `admin/modals/ticket_mail/ticket_mail_try.php` (`?try=1` answers JSON with the result).
- Weekly summary: database 4.0.7 adds `settings.config_weekly_summary`, `_day` (1 Monday to 7 Sunday), `_to` (NULL for every admin) and `_sent_at`. `functions/weekly_summary.php`: `weeklySummaryReady()`, `weeklySummarySettings()`, `weeklySummaryRecipients()`, `weeklySummaryNumbers($from, $to)`, `weeklySummaryNeeds()`, `weeklySummaryEmail($until)`, `weeklySummarySend()` and `weeklySummaryRun()`, called by `cron/nightly_tasks.php`, which sends once on the day (`config_weekly_summary_sent_at`). `send_weekly_summary_now` in `admin/post/settings_notification.php`; the `weekly_summary` email preview.
+- Related tickets: database 4.0.8 adds `ticket_links` (`ticket_id` as the primary key, `link_group`, `linked_by`, `linked_at`; deleted with its ticket). `functions/ticket_link.php`: `ticketLinksReady()`, `ticketLinkGroup()`, `ticketLinkMembers()`, `ticketLinkTogether()` (any number of tickets and everything already related to them into one group, with a ticket history line naming the newly related ones), `ticketUnlink()`, `ticketRelated()` and `ticketLinkCounts()` (scoped to the agent's clients), `ticketLinkHidden()`, `ticketLinkCandidates()` and `ticketLinkCarry()` (from `ticketMergeInto()`). A group is numbered by its lowest ticket id, renumbered by `ticketLinkTidy()` as tickets leave, so one number never names two groups; a group left with one ticket is deleted. `agent/post/ticket_link.php` handles `link_tickets`, `unlink_ticket` and `bulk_link_tickets`; Reply to all and Resolve all open `ticket_bulk_reply.php` and `ticket_bulk_resolve.php` with `ticket_ids[]`.
## [26.11.8]
diff --git a/admin/database_updates/4.0.8.php b/admin/database_updates/4.0.8.php
new file mode 100644
index 000000000..0d620730f
--- /dev/null
+++ b/admin/database_updates/4.0.8.php
@@ -0,0 +1,25 @@
+
+
+
+
Link related tickets = $reference ?>
+
+
+
+
+" . escapeHtml(ticketReference($row)) . " is related to $related_count ticket" . ($related_count === 1 ? '' : 's') . " now"
+ : 'They were already related.');
+
+ redirect();
+
+}
+
+// The x on a related ticket - it comes out of the group, the rest stay related
+if (isset($_GET['unlink_ticket'])) {
+
+ validateCSRFToken();
+
+ $row = ticketForRequest($_GET['unlink_ticket'], 2);
+ $ticket_id = intval($row['ticket_id']);
+
+ if (ticketUnlink($ticket_id)) {
+ logAudit("Ticket", "Unlink", "$session_name took ticket " . escapeSql(ticketReference($row)) . " out of its related tickets", intval($row['ticket_client_id']), $ticket_id);
+ flashAlert("" . escapeHtml(ticketReference($row)) . " is no longer related to the others");
+ }
+
+ redirect();
+
+}
+
+// Bulk Action > Link together on the tickets list - the tickets ticked, as one group
+if (isset($_POST['bulk_link_tickets'])) {
+
+ validateCSRFToken();
+
+ $rows = ticketsForBulk(2);
+ if (count($rows) < 2) {
+ flashAlert('Tick at least two tickets to link together.', 'error');
+ redirect();
+ }
+
+ $joined = ticketLinkTogether(array_keys($rows));
+
+ logAudit("Ticket", "Bulk Link", "$session_name linked " . count($rows) . " tickets together");
+
+ flashAlert($joined ? "Linked " . count($rows) . " tickets together" : 'They were already related.');
+
+ redirect();
+
+}
diff --git a/agent/ticket.php b/agent/ticket.php
index 6299bf191..b5d3beecd 100644
--- a/agent/ticket.php
+++ b/agent/ticket.php
@@ -217,6 +217,17 @@ if (isset($_GET['ticket_id'])) {
$also_open = empty($ticket['ticket_resolved_at']) && empty($ticket['ticket_closed_at'])
? ticketAlsoOpen($contact_id, intval($ticket['ticket_asset_id']), $ticket_id, 6) : [];
+ // The tickets it is linked with - the same outage at other clients, say (functions/ticket_link.php)
+ $related = ticketRelated($ticket_id);
+ $related_hidden = ticketLinkHidden($ticket_id, count($related));
+ // This one and the open ones, for one update or resolve to them all
+ $related_open_ids = array_merge($ticket_is_closed ? [] : [$ticket_id], array_map('intval', array_column(array_filter($related, function ($other) {
+ return $other['is_open'];
+ }), 'ticket_id')));
+ $related_open_query = implode('&', array_map(function ($id) {
+ return 'ticket_ids[]=' . $id;
+ }, $related_open_ids));
+
// Reply counts, one pass - these drive the conversation filter
$reply_counts = array('total' => 0, 'public' => 0, 'internal' => 0);
$sql_reply_counts = mysqli_query(
@@ -668,6 +679,11 @@ if (isset($_GET['ticket_id'])) {
Merge into another ticket
+
+
+ Link related tickets
+
+
Move to another client
@@ -1526,6 +1542,56 @@ if (isset($_GET['ticket_id'])) {
+
+
+
+ = $related_hidden ?> more for = $related_hidden === 1 ? 'a client' : 'clients' ?> you can't open
+
+
+
+
+
+
diff --git a/agent/ticket_list.php b/agent/ticket_list.php
index 8f54a1d7c..813ba1fa4 100644
--- a/agent/ticket_list.php
+++ b/agent/ticket_list.php
@@ -68,6 +68,7 @@ while ($row = mysqli_fetch_assoc($sql)) {
$last_replies = ticketLastReplies(array_keys($tickets));
$tickets_tags = tagsForRecords('ticket', array_keys($tickets));
$task_counts = ticketTaskCounts(array_keys($tickets));
+$link_counts = ticketLinkCounts(array_keys($tickets));
// A Due column only when there is something to put in it
$show_due = $sla_in_use || mysqli_num_rows(mysqli_query($mysqli, "SELECT 1 FROM tickets WHERE ticket_due_at IS NOT NULL AND ticket_closed_at IS NULL LIMIT 1"));
@@ -191,6 +192,9 @@ $sort_link = function ($column, $label, $class = '') use ($url_query_strings_sor
= ticketTasksHtml($task_counts[$ticket_id] ?? null) ?>
+
+ = $link_counts[$ticket_id] ?>
+
diff --git a/agent/tickets.php b/agent/tickets.php
index 0c469f383..0a0994e10 100644
--- a/agent/tickets.php
+++ b/agent/tickets.php
@@ -387,6 +387,11 @@ $export_extra = [
Add to a project
+
+
+