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

@@ -229,12 +229,12 @@ function mailRouteReach($match, $client_id = 0) {
$match_sql = escapeSql($match);
$other = "AND contact_client_id <> $client_id";
if (strpos($match, '@') !== false) {
$out['contacts'] = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM contacts WHERE contact_archived_at IS NULL AND LOWER(contact_email) = '$match_sql' $other"))[0] ?? 0);
$out['contacts'] = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM contacts WHERE contact_archived_at IS NULL $other AND " . contactEmailMatchSql($match)))[0] ?? 0);
return $out;
}
$like = escapeSql(str_replace(['\\', '%', '_'], ['\\\\', '\%', '\_'], $match));
$out['contacts'] = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM contacts WHERE contact_archived_at IS NULL $other
AND (LOWER(contact_email) LIKE '%@$like' OR LOWER(contact_email) LIKE '%.$like')"))[0] ?? 0);
// Their email or their alternate one (functions/contact.php)
$out['contacts'] = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM contacts WHERE contact_archived_at IS NULL $other AND " . contactEmailMatchSql($match)))[0] ?? 0);
$sql = mysqli_query($mysqli, "SELECT DISTINCT client_name FROM domains JOIN clients ON client_id = domain_client_id
WHERE domain_archived_at IS NULL AND client_archived_at IS NULL AND client_id <> $client_id AND (LOWER(domain_name) = '$match_sql' OR LOWER(domain_name) LIKE '%.$like')
ORDER BY client_name LIMIT 5");