Rename watchers to CCs in the database and code: database 4.2.8 renames ticket_watchers to ticket_ccs with its columns and index, functions, settings, form and post names, the Add CC modal file, JavaScript IDs, the email preview key and the To line group follow; the ticket email parser waits while a database update is pending instead of flagging email it cannot take; 26.12.3 changelog updated

This commit is contained in:
johnnyq
2026-11-30 14:01:11 -05:00
parent ee3f31ff05
commit b8db50adfa
26 changed files with 253 additions and 189 deletions

View File

@@ -311,9 +311,9 @@ if (isset($_GET['ticket_id'])) {
}
}
// Get Watchers
$sql_ticket_watchers = mysqli_query($mysqli, "SELECT watcher_email, watcher_id FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id ORDER BY watcher_email DESC");
$watcher_count = mysqli_num_rows($sql_ticket_watchers);
// Get CCs
$sql_ticket_ccs = mysqli_query($mysqli, "SELECT ticket_cc_email, ticket_cc_id FROM ticket_ccs WHERE ticket_cc_ticket_id = $ticket_id ORDER BY ticket_cc_email DESC");
$cc_count = mysqli_num_rows($sql_ticket_ccs);
// Get Additional Assets
$sql_additional_assets = mysqli_query($mysqli, "SELECT assets.asset_id, asset_name, asset_type FROM assets, ticket_assets
@@ -362,7 +362,7 @@ if (isset($_GET['ticket_id'])) {
/*
* Ticket history. agent/post/ticket.php has been writing priority, SLA,
* contact, watcher and asset changes here all along - the page fetched
* contact, CC and asset changes here all along - the page fetched
* the rows and then never rendered them.
*/
$sql_ticket_history = mysqli_query($mysqli, "SELECT ticket_history_description, ticket_history_created_at
@@ -910,7 +910,7 @@ if (isset($_GET['ticket_id'])) {
</div>
<?php } elseif ($can_email_reply) { ?>
<div data-audience="2" hidden>
<i class="fas fa-fw fa-paper-plane me-1"></i>Emails <strong><?= $contact_name ?></strong> &lt;<?= $contact_email ?>&gt;<?php if ($watcher_count) { ?> and <?= $watcher_count ?> CC<?= $watcher_count == 1 ? '' : 's' ?><?php } ?>, and shows in the portal.
<i class="fas fa-fw fa-paper-plane me-1"></i>Emails <strong><?= $contact_name ?></strong> &lt;<?= $contact_email ?>&gt;<?php if ($cc_count) { ?> and <?= $cc_count ?> CC<?= $cc_count == 1 ? '' : 's' ?><?php } ?>, and shows in the portal.
</div>
<?php } ?>
<?php if ($sms_recipient && !$sms_recipient['opted_out']) { ?>
@@ -924,7 +924,7 @@ if (isset($_GET['ticket_id'])) {
<?php if ($reply_to) { ?>
<!--
* Who an email reply goes to: the contact, watchers and colleagues to start
* Who an email reply goes to: the contact, CCs and colleagues to start
* with; anyone else here, or an address typed in, can be added. Whatever is
* changed is kept for the ticket, so its next email reply starts from it.
-->
@@ -1865,7 +1865,7 @@ if (isset($_GET['ticket_id'])) {
$can_link = $can_edit_ticket && !$ticket_is_closed;
// The services it is about - raised for them, or through its assets
$ticket_services = $client_id ? ticketServices($ticket_id) : [];
$has_links = $asset_id || $vendor_id || $project_id || $watcher_count || $ticket_services;
$has_links = $asset_id || $vendor_id || $project_id || $cc_count || $ticket_services;
if ($has_links || $can_link) { ?>
<div class="card mb-3">
<div class="card-header px-3 py-2">
@@ -1890,7 +1890,7 @@ if (isset($_GET['ticket_id'])) {
<?= linkPickerButton('ticket', $ticket_id, 'service', 'Link a service', 'dropdown-item', 'fas fa-fw fa-stream me-2') ?>
<div class="dropdown-divider"></div>
<?php } ?>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_add_watcher.php?ticket_id=<?= $ticket_id ?>">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_add_cc.php?ticket_id=<?= $ticket_id ?>">
<i class="fas fa-fw fa-user-plus me-2"></i>Add CC
</a>
</div>
@@ -2005,18 +2005,18 @@ if (isset($_GET['ticket_id'])) {
<?php } ?>
<?php } ?>
<?php if ($watcher_count) { ?>
<?php if ($cc_count) { ?>
<div class="ticket-link-heading <?= ($asset_id || $vendor_id || $project_id || $ticket_services) ? 'mt-3 pt-2 border-top' : '' ?>">
CC <span class="text-body-secondary text-lowercase fw-normal">&middot; copied in on its emails</span>
</div>
<?php while ($watcher_row = mysqli_fetch_assoc($sql_ticket_watchers)) {
$watcher_id = intval($watcher_row['watcher_id']);
$ticket_watcher_email = escapeHtml($watcher_row['watcher_email']);
<?php while ($cc_row = mysqli_fetch_assoc($sql_ticket_ccs)) {
$cc_id = intval($cc_row['ticket_cc_id']);
$cc_email_html = escapeHtml($cc_row['ticket_cc_email']);
?>
<div class="mt-1 d-flex align-items-center">
<span class="text-truncate flex-grow-1" title="<?= $ticket_watcher_email ?>"><i class="fas fa-fw fa-envelope text-secondary me-2"></i><?= $ticket_watcher_email ?></span>
<span class="text-truncate flex-grow-1" title="<?= $cc_email_html ?>"><i class="fas fa-fw fa-envelope text-secondary me-2"></i><?= $cc_email_html ?></span>
<?php if ($can_link) { ?>
<a class="confirm-link ms-2" href="post.php?delete_ticket_watcher=<?= $watcher_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>" title="Stop copying <?= $ticket_watcher_email ?>">
<a class="confirm-link ms-2" href="post.php?delete_ticket_cc=<?= $cc_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>" title="Stop copying <?= $cc_email_html ?>">
<i class="fas fa-fw fa-times text-secondary"></i>
</a>
<?php } ?>