Mail review stage 1: people copied in on an email become a ticket's CCs only from the email that raises it or a reply to one of its emails, not a reply matched by the number in its subject alone; a subject too long for the mail queue is cut to fit and an email the queue turns away is logged rather than stopping the page or the mailbox; emailed files use the same list as attached ones, which gains heic, heif, tif, tiff, eml, xlsm, ppt, rtf and log, with an internal note naming any file left out; names with an apostrophe escaped once; 26.12.3 changelog

This commit is contained in:
johnnyq
2026-11-30 16:49:01 -05:00
parent c98ea0e686
commit a9e5bc66db
12 changed files with 149 additions and 45 deletions

View File

@@ -251,6 +251,38 @@ function ticketMailCopiedCcs($ticket_id, array $addresses, $sender) {
return ticketAddCcs($ticket_id, array_slice($emails, 0, 20));
}
/** Why an emailed file with the extension $extension isn't added to a ticket - it isn't one of TICKET_ATTACHMENT_EXTENSIONS. */
function ticketMailFileTypeWhy($extension) {
$extension = strtolower(trim((string) $extension));
return $extension === '' ? 'its name has no file type' : "ITFlow doesn't take .$extension files";
}
/*
* Say on a ticket which files with an email weren't added to it - $dropped [['name', 'why'], ...], a kind
* ITFlow doesn't take (ticketMailFileTypeWhy()) or too big - in an internal note, as they used to be in
* the audit log alone. They are still in the email as it came, kept with the ticket. The note's id, or 0.
*/
function ticketMailFilesLeftOut($ticket_id, array $dropped) {
global $mysqli;
$ticket_id = intval($ticket_id);
$items = [];
foreach ($dropped as $file) {
$name = trim((string) ($file['name'] ?? ''));
$items[] = '<li>' . escapeHtml($name !== '' ? $name : 'A file with no name') . ' - ' . escapeHtml((string) ($file['why'] ?? '')) . '</li>';
}
if (!$ticket_id || !$items) {
return 0;
}
$count = count($items);
$note = '<b>' . ($count === 1 ? 'A file with the email was' : "$count files with the email were") . ' not added to the ticket</b><ul>' . implode('', $items) . '</ul>'
. "<i>They are in the email as it came - Original-parsed-email.eml on this ticket - and in the mailbox's ITFlow folder.</i>";
mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = '" . mysqli_real_escape_string($mysqli, $note) . "', ticket_reply_type = 'Internal',
ticket_reply_time_worked = '00:00:00', ticket_reply_by = 0, ticket_reply_ticket_id = $ticket_id");
$note_id = intval(mysqli_insert_id($mysqli));
logTicketHistory($ticket_id, $count === 1 ? "A file with an email wasn't added - noted" : "$count files with an email weren't added - noted");
return $note_id;
}
/*
* A client's reply - by email, text or in the portal - passed on to the people an agent's reply goes to
* (the ticket's To line, ticketReplyRecipients()) who didn't have it: not whoever wrote it, nor