From c94aeaf4a70d241f4c4515b53492f408751b0930 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 2 Dec 2026 14:12:09 -0500 Subject: [PATCH] Release 26.12.4: set the app version to 26.12.4, split the changelog's Upgrading section into the database changes, 4.3.8 to 4.4.1, and what changes when you update - autopay card reminders emailed the first night, agents' names in the From name, forwarded client emails as the client's tickets and the reply box opening on return - and a routing rule's own contact is recognized from their alternate email too (mailRouteTargets()) --- CHANGELOG.md | 9 +++++++-- functions/mail_route.php | 3 ++- includes/app_version.php | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81acb1431..83f23f2b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,12 @@ This file documents all notable changes made to ITFlow. ### Upgrading to 26.12.4 -Update from Maintenance > Update as usual. This release has four database changes: 4.3.8, which lets ITFlow remind clients before their autopay card expires - a setting for it, and on each saved card when it was last checked with Stripe, which reminders went out and the key in their link - 4.3.9, which adds the table that keeps email routing rules, 4.4.0, which keeps the reply type with an unsent reply, and 4.4.1, which adds an alternate email to contacts. +Update from Maintenance > Update as usual. This release has four database changes, 4.3.8 to 4.4.1: 4.3.8 lets ITFlow remind clients before their autopay card expires - a setting for it, and on each saved card when it was last checked with Stripe, which reminders went out and the key in their link - 4.3.9 adds the table that keeps email routing rules, 4.4.0 keeps the reply type with an unsent reply, and 4.4.1 adds an alternate email to contacts. + +- With Stripe set up, the first night after the update emails each client whose card on autopay runs out in the month ahead, or ran out in the last 60 days, a link to add their new card - to their primary and billing contacts, unless the client is left out of reminders - and your team gets a Card Expiring notification for each. Cards are checked with Stripe first, so one the bank has already replaced isn't mentioned. To look before anyone is emailed, switch off Email clients before their autopay card expires in Admin > Settings > Invoices > Paid online straight after updating, and see Admin > Payment Providers > Saved Cards. +- Your agents' emails to clients come from them by name - "Tess Tech | Support" - at the ticket mailbox's address. There's no setting for it; Admin > Mail > From addresses shows how it reads. +- An email an agent forwards to the ticket mailbox is a ticket for the client who wrote it, from that person, with what the agent wrote above it as their internal note - before, it was a ticket from the agent, for your own company or no client. Someone at a client's domain who isn't a contact yet is added as one. +- Coming back to a ticket with an unsent reply, or with its timer still running, opens the reply box. ### New Features & Updates @@ -43,7 +48,7 @@ Update from Maintenance > Update as usual. This release has four database change - Where an email goes is decided in one place: `ticketMailDecide(array $in)` in new `functions/ticket_mail_decide.php`, used by `cron/ticket_email_parser.php` and `ticketMailTry()`. It takes raw facts - `from`, `from_name`, `subject`, `visitor` (a website form's Reply-To), `thread_ticket_id` (null when it can't be known), `automatic`, `forged`, `answers_ours` (null when unknown), `unprocessed`, `forward` - and runs steps 1-6 (thread, ticket number, the agent who may be forwarding, the routing rule, the sender's contact or domain, the out-of-office set-aside, similar subject, contact, routed client, client domain, unknown senders), returning `steps` ([question, answer], what Try an Email shows) and an `action` - `reply` (`ticket_id`, `by`), `ticket` (`client_id`, `client_name`, `contact`, `new_contact`, `picked`, `sender`, `similar`, `link_why`, `taken`), `set_aside` or `leave` (`why`, `not_ours`, `answers_unknown`) - with `agent`, `route` and `quiet`. The parser keeps its first checks (own address, bounce, ignored sender, Reply-To, duplicate Message-ID, Unprocessed Email asks), then carries the decision out; when `agent` is set it reads the forward and calls `ticketMailDecide()` again with `forward`, which skips steps 1-2 as before. `ticketMailTry()` keeps its own first checks and turns the decision into an outcome with `ticketMailTryOutcome()`. Changes in behaviour: the similar-subject check compares raw subjects and the CC lookup escapes the sender once (it was escaped twice, missing an address with an apostrophe), an out-of-office that isn't set aside is left in the inbox rather than going on to the similar-subject step, and a reply whose ticket vanished between the lookup and `addReply()` waits in Unprocessed Email instead of becoming a new ticket. - Reply type after posting: `agent/modals/ticket/ticket_reply_edit.php` offers `Email` beside `Internal` and `Public` (while the ticket isn't closed, `config_smtp_provider` is set, the contact has an email address and `ticket_reply_emailed` isn't 1), with the ticket's To line (`ticketReplyRecipients()`). `edit_ticket_reply` saves it Public, appends the writer's `user_config_signature`, emails it with `ticketMailReply()` (from the writer by name via its `ticket_reply_id`, the To line by `ticketReplyRecipientsPick()`, its files by new `ticketReplyFiles()` in `functions/ticket_mail_thread.php`, which the client-reply relay now uses too) and `smsTicketReplyNotify()`. A reply that becomes Public, or is emailed, sets the first response when there is none and, with `ticketReplyAssigns()`, assigns an unassigned ticket to its writer (the editing agent when the writer isn't an active agent). The history line names the change. Refused emails say why: closed, emailed already, no mail, no contact email. - Reply drafts keep their type (DB 4.4.0, `ticket_reply_drafts.draft_type`, NULL for older drafts): `ticketReplyDraftSave($ticket_id, $user_id, $html, $type = null)`, `ticketReplyDraft()` returns `type`, `agent/ajax.php?ticket_reply_draft` takes `type`, and `agent/js/ticket_reply_extras.js` sends the picked `public_reply_type` with each save (and beacon), saving again when the type changes with words in the box. `agent/ticket.php` puts `data-draft-type` on the reply form; as the page is drawn the composer opens (the `show` class, no focus or scroll) on the draft's type, or - when `localStorage[ticketId + '-startTime']` was there before the timer script ran - on `localStorage['ticket-reply-type-' + ticketId]`, kept as a type is picked and cleared on Cancel and on sending, else Internal note; a type that can't be used now (email with no contact address, an opted-out text) falls back to Internal note. The reply menu item reads Edit or Change Type. -- Contact alternate email (DB 4.4.1, `contacts.contact_email_alt` varchar(200), NULL): new helpers in `functions/contact.php` - `contactEmailAltReady()` (version check), `contactEmailSql($email, $table = '')` (`contact_email` or `contact_email_alt` equals it; `0` for an empty address), `contactEmailAltColumn()` and `contactEmailAltLikeSql($like, $table = '')` for SELECTs and searches before the update, `contactHasEmail(array $row, $email)` and `contactEmailAltClean($alt, $email)` (trimmed; empty unless a valid address of 200 characters or fewer that isn't `$email` in any case). `agent/post/contact_model.php` and `api/v1/contacts/contact_model.php` set it only when `email_alt` / `contact_email_alt` is posted, so other forms and API calls leave it; anonymize clears it. `agent/ajax.php?contact_email_check` matches either column and says "as their alternate email"; the form says an alternate equal to Email as it is typed. Searches in `agent/contacts.php`, `agent/clients.php`, `agent/tickets.php`, `functions/search.php` and the contacts and clients exports add it; `functions/export.php` has the `contact_email_alt` column and `functions/import_kinds.php` the `email_alt` field (`importContactRow()` leaves out one that is the Email or not an address, with a note). API: `create.php` counts an alternate as a duplicate at the client and `read.php?contact_email=` matches either. Incoming email: `ticketMailSenderContact()` matches either column, ordering a contact whose `contact_email` it is before one whose alternate it is (after the client-domain match); `ticketMailDecide()` finds a routed client's contact by either and treats a sender matching `contactHasEmail()` as the contact (not quiet, their own ticket for the similar-subject check), setting `sender` whenever the address isn't the contact's `contact_email`, so `addTicket()` shows it on the from line while the created email still goes to `contact_email`. `addReply()`, `ticketMailTryReply()`, `ticketMailClientAddresses()`, `ticketMailCopiedCcs()` (never the contact by either address) and the Unprocessed Email ticket and reply modals use both. `contactEmailMatchSql($match)` (an address, or a domain and its subdomains, across both columns) is what `mailIgnoreReach()` and `mailRouteReach()` count now. +- Contact alternate email (DB 4.4.1, `contacts.contact_email_alt` varchar(200), NULL): new helpers in `functions/contact.php` - `contactEmailAltReady()` (version check), `contactEmailSql($email, $table = '')` (`contact_email` or `contact_email_alt` equals it; `0` for an empty address), `contactEmailAltColumn()` and `contactEmailAltLikeSql($like, $table = '')` for SELECTs and searches before the update, `contactHasEmail(array $row, $email)` and `contactEmailAltClean($alt, $email)` (trimmed; empty unless a valid address of 200 characters or fewer that isn't `$email` in any case). `agent/post/contact_model.php` and `api/v1/contacts/contact_model.php` set it only when `email_alt` / `contact_email_alt` is posted, so other forms and API calls leave it; anonymize clears it. `agent/ajax.php?contact_email_check` matches either column and says "as their alternate email"; the form says an alternate equal to Email as it is typed. Searches in `agent/contacts.php`, `agent/clients.php`, `agent/tickets.php`, `functions/search.php` and the contacts and clients exports add it; `functions/export.php` has the `contact_email_alt` column and `functions/import_kinds.php` the `email_alt` field (`importContactRow()` leaves out one that is the Email or not an address, with a note). API: `create.php` counts an alternate as a duplicate at the client and `read.php?contact_email=` matches either. Incoming email: `ticketMailSenderContact()` matches either column, ordering a contact whose `contact_email` it is before one whose alternate it is (after the client-domain match); `ticketMailDecide()` finds a routed client's contact by either - a rule's own contact (`mailRouteTargets()`) carries `contact_email_alt` too - and treats a sender matching `contactHasEmail()` as the contact (not quiet, their own ticket for the similar-subject check), setting `sender` whenever the address isn't the contact's `contact_email`, so `addTicket()` shows it on the from line while the created email still goes to `contact_email`. `addReply()`, `ticketMailTryReply()`, `ticketMailClientAddresses()`, `ticketMailCopiedCcs()` (never the contact by either address) and the Unprocessed Email ticket and reply modals use both. `contactEmailMatchSql($match)` (an address, or a domain and its subdomains, across both columns) is what `mailIgnoreReach()` and `mailRouteReach()` count now. ## [26.12.3] diff --git a/functions/mail_route.php b/functions/mail_route.php index 956058160..57715c596 100644 --- a/functions/mail_route.php +++ b/functions/mail_route.php @@ -112,7 +112,8 @@ function mailRouteTargets(array $rule) { } $contact_id = intval($rule['routing_rule_contact_id']); if ($contact_id && $out['client']) { - $out['contact'] = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_email, contact_client_id FROM contacts + // With their alternate email, so email from it is theirs as well (contactHasEmail(), functions/contact.php) + $out['contact'] = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_email, " . contactEmailAltColumn() . ", contact_client_id FROM contacts WHERE contact_id = $contact_id AND contact_client_id = $client_id AND contact_archived_at IS NULL LIMIT 1")) ?: null; if (!$out['contact']) { $out['gone'][] = 'its contact is archived or deleted'; diff --git a/includes/app_version.php b/includes/app_version.php index 3a8185f23..87b19ac89 100644 --- a/includes/app_version.php +++ b/includes/app_version.php @@ -5,4 +5,4 @@ * Update this file each time we merge develop into master. Format is YY.MM (add a .v if there is more than one release a month. */ -DEFINE("APP_VERSION", "26.12.3"); +DEFINE("APP_VERSION", "26.12.4");