" . 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();
}