Contact alternate email (DB 4.4.1): one more address per contact in the contact window under Email, shown on their page, quick look and the Reach column, searched by the contacts, clients, tickets and global searches, exported and imported as Alternate Email and in the API as contact_email_alt, and recognized on incoming email as theirs - a new ticket as them at their client even with unknown senders off, and their reply by ticket number, conversation or subject - with the ticket's from line showing the address it came from while everything ITFlow sends still goes to their Email and neither address is copied in; the duplicate warning, Try an Email, Unprocessed Email and the ignored sender and routing rule warnings count it too, and the same-as-Email warning shows while typing (contactEmailSql(), contactHasEmail(), contactEmailMatchSql()); 26.12.4 changelog

This commit is contained in:
johnnyq
2026-12-02 13:36:49 -05:00
parent 8dae372d57
commit 2ad57e2865
31 changed files with 276 additions and 80 deletions

View File

@@ -2602,13 +2602,15 @@ if (isset($_GET['contact_email_check'])) {
// 1. Duplicate check - who has it, where the agent may see them; not the contact being edited
$exclude_contact = intval($_GET['exclude'] ?? 0);
$sql_contacts = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_client_id, contact_archived_at, client_name FROM contacts
// Their email, or their alternate one (contactEmailSql(), functions/contact.php)
$sql_contacts = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_client_id, contact_archived_at, client_name,
" . (contactEmailAltReady() ? "contact_email_alt = '$email' AND contact_email <> '$email'" : '0') . " AS as_alt FROM contacts
LEFT JOIN clients ON client_id = contact_client_id
WHERE contact_email = '$email' AND contact_id != $exclude_contact ORDER BY contact_archived_at IS NOT NULL, contact_id DESC LIMIT 1");
WHERE " . contactEmailSql(stripslashes($email)) . " AND contact_id != $exclude_contact ORDER BY contact_archived_at IS NOT NULL, contact_id DESC LIMIT 1");
if ($row = mysqli_fetch_assoc($sql_contacts)) {
$response['message'] = hasClientAccess($row['contact_client_id'])
? "<i class='far fa-fw fa-copy me-2'></i>Already on file: <a href='contact.php?client_id=" . intval($row['contact_client_id']) . "&contact_id=" . intval($row['contact_id']) . "' target='_blank' rel='noopener'>" . escapeHtml($row['contact_name']) . "</a>"
. " at " . escapeHtml($row['client_name']) . ($row['contact_archived_at'] ? ' (archived)' : '')
. " at " . escapeHtml($row['client_name']) . (intval($row['as_alt']) ? ', as their alternate email' : '') . ($row['contact_archived_at'] ? ' (archived)' : '')
: "<i class='far fa-fw fa-copy me-2'></i>Already on file for a client you cannot open.";
}