mirror of
https://github.com/itflow-org/itflow
synced 2026-12-02 00:59:03 +00:00
Ticket CCs in the API: ticket_ccs read, create and delete endpoints scoped through the ticket's client, adding one address or several with an optional email to each new CC, removing by id or by address at Modify as on the ticket page, closed tickets left as they are, ticket history and audit lines; tickets/create takes ticket_ccs before its first email goes out and tickets/read returns each ticket's CCs; 26.12.3 changelog
This commit is contained in:
@@ -51,6 +51,7 @@ Update from Maintenance > Update as usual - this release has seven database chan
|
||||
- Invoicing a ticket on a new invoice gives the invoice the ticket's number and subject as its scope, without asking - change it on the invoice. Making a quote from a ticket has a smaller description box.
|
||||
- A ticket's emails stay together as one conversation in the client's inbox. Each has the same subject from the first to the last - its number in brackets, then its subject: [TCK-123] Printer offline - where it used to change with each email ("Ticket update - ...", "Ticket resolved - ... | (pending closure)"), and each carries the headers mail programs keep a conversation together by. A reply finds its ticket by those headers first, so one whose subject was changed still lands on it, and so does a reply to all on the client's first email, sent before anyone had the ticket's number.
|
||||
- Watchers are called CCs, as that is what they are now: on every email about the ticket, and their replies count as the client's. On a ticket it's the CC list on the Linked card and Add CC on its +, and New Ticket has a CC field.
|
||||
- API: a ticket's CCs can be read, added and taken off, and a ticket raised through the API can have CCs from the start, copied in on its first email. New CCs can be emailed a link to the ticket, as Add CC does. Tickets read through the API come with their CCs.
|
||||
- One email, with the CCs copied in: an email about a ticket goes to its contact with the CCs, and the colleagues who asked for every update, copied in (Cc), so they see who else has it and a reply to all reaches everyone. The To line on an email reply works the same way - the contact in To, everyone else copied in. Switch it off under Admin > Settings > Tickets, Emails about a ticket, for an email each as before.
|
||||
- A client's reply goes on to the CCs: when the client replies by email, text or in the portal, the people an agent's reply would go to get it too, with its files - not anyone it was already to or copied to. By email, only a reply to one of the ticket's emails is passed on, as anyone can put a ticket number in a subject. It can be switched off in the same place.
|
||||
- Whoever the client also emails, or copies in, follows the ticket: the other people in To and Cc on the email that raises a ticket, and on a reply from the client or a CC, become its CCs - never your own addresses, anyone else at your domain or your agents. The ticket's history says who.
|
||||
@@ -126,6 +127,7 @@ Update from Maintenance > Update as usual - this release has seven database chan
|
||||
- Database 4.2.7: ticket_replies.ticket_reply_from_name and ticket_reply_from_email, set on a client reply from a CC (ticketReplyFromReady()). ticketReplyAuthorSql() selects COALESCE(contact_name, ticket_reply_from_name, ticket_reply_from_email) AS contact_name in every reply query that names a client reply - the ticket page, quick look, split, pulse, project and email history, AI summaries, the portal and the guest page. Try an Email (functions/ticket_mail_try.php) follows: a bounce address first, automatic replies as a note or set aside, CCs as client replies, closed tickets as notes, and near-same subjects from someone else linked.
|
||||
- Watchers are CCs in every page, email, ticket history line, log and message, and in the code. Database 4.2.8 renames ticket_watchers to ticket_ccs and its watcher_id, watcher_name, watcher_email and watcher_ticket_id to ticket_cc_id, ticket_cc_name, ticket_cc_email and ticket_cc_ticket_id, with its index. ticketWatcherEmails(), ticketAddWatchers(), ticketMailWatchersAdded() and ticketMailCopiedWatchers() are ticketCcEmails(), ticketAddCcs(), ticketMailCcsAdded() and ticketMailCopiedCcs(); ticketMailSend()'s to_watchers and ticketMailCreated()'s $to_watchers are to_ccs; the watcher group, email kind and sender are cc; the posts add_ticket_watcher (watcher_email, watcher_notify), delete_ticket_watcher and New Ticket's watchers[] are add_ticket_cc (cc_email, cc_notify), delete_ticket_cc and ccs[]; agent/modals/ticket/ticket_add_watcher.php is ticket_add_cc.php; the email preview ticket_watcher is ticket_cc.
|
||||
- The ticket email parser waits while a database update is pending, rather than flag email it can't take - a flagged email is left in the mailbox for good.
|
||||
- API ticket CCs: api/v1/ticket_ccs/ has read.php (ticket_id or ticket_cc_id), create.php (ticket_cc_email - one address, or several as a list or separated by commas - and ticket_cc_notify) and delete.php (ticket_cc_id, or ticket_id and ticket_cc_email), each finding the ticket through ticket_cc_find.php, and is mapped to module_support in enforce_api_rbac.php. Its delete.php needs Modify, as the ticket page does, through the new $resource_operation_level, which sets one resource's file apart from $operation_level. A closed ticket's CCs aren't changed. tickets/create.php takes ticket_ccs and answers with those added, and tickets/read.php attaches each ticket's ticket_ccs (ticketCcsApiAttach(), when $api_ticket_ccs is set for read_output.php). ticketCcEmailsValid() is ticketCcEmails() naming the first entry that isn't an email address, for the API to refuse.
|
||||
|
||||
## [26.12.2]
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ $resource_module = [
|
||||
'files' => 'module_support',
|
||||
'folders' => 'module_support',
|
||||
'ticket_replies' => 'module_support',
|
||||
'ticket_ccs' => 'module_support',
|
||||
'technicians' => 'module_support',
|
||||
'projects' => 'module_support',
|
||||
'tasks' => 'module_support',
|
||||
@@ -248,7 +249,13 @@ if (!isset($resource_module[$resource])) {
|
||||
apiDeny("This API resource is not mapped to a permission module.");
|
||||
}
|
||||
|
||||
$required_level = $operation_level[$operation_file] ?? 2;
|
||||
// Where a resource's page asks less than its file's name says - a CC comes off a ticket as an edit of the
|
||||
// ticket, at Modify, as the x beside them on its page does, not a delete at Full
|
||||
$resource_operation_level = [
|
||||
'ticket_ccs' => ['delete.php' => 2],
|
||||
];
|
||||
|
||||
$required_level = $resource_operation_level[$resource][$operation_file] ?? $operation_level[$operation_file] ?? 2;
|
||||
if ($resource_module[$resource] !== '' && lookupUserPermission($resource_module[$resource]) < $required_level) {
|
||||
apiDeny(apiPermissionText($resource_module[$resource], $required_level));
|
||||
}
|
||||
|
||||
@@ -30,6 +30,11 @@ if ($sql && mysqli_num_rows($sql) > 0) {
|
||||
$return_arr['data'] = rmmApiAttach($return_arr['data']);
|
||||
}
|
||||
|
||||
// Each ticket's CCs, as ticket_ccs ($api_ticket_ccs, set by api/v1/tickets/read.php)
|
||||
if (!empty($api_ticket_ccs)) {
|
||||
$return_arr['data'] = ticketCcsApiAttach($return_arr['data']);
|
||||
}
|
||||
|
||||
echo json_encode($return_arr);
|
||||
exit();
|
||||
}
|
||||
|
||||
83
api/v1/ticket_ccs/create.php
Normal file
83
api/v1/ticket_ccs/create.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/*
|
||||
* API - Ticket CCs - Create
|
||||
* POST /api/v1/ticket_ccs/create.php
|
||||
*
|
||||
* Add CCs to a ticket, as Add CC does on its page - each is copied in on every
|
||||
* email about the ticket from then on, and their replies count as the client's.
|
||||
* Not on a closed ticket, and never one of ITFlow's own addresses.
|
||||
*
|
||||
* Parameters (POST, JSON body):
|
||||
* api_key required - Your API key
|
||||
* ticket_id required - The ticket
|
||||
* ticket_cc_email required - An email address, or several: a list, or one string
|
||||
* separated by commas
|
||||
* ticket_cc_notify optional - 1 emails each new CC a link to the ticket now, as
|
||||
* "Email them a link to this ticket now" does
|
||||
* client_id the ticket's client - needed when the key's user is limited to
|
||||
* certain clients
|
||||
*
|
||||
* Answer: insert_id (the first added), added - each CC added, with its ticket_cc_id -
|
||||
* and notified, how many were emailed.
|
||||
*/
|
||||
|
||||
require_once '../validate_api_key.php';
|
||||
require_once '../require_post_method.php';
|
||||
|
||||
// Whether ITFlow sends email ($config_smtp_provider)
|
||||
require_once "../../../includes/load_global_settings.php";
|
||||
|
||||
$insert_id = false;
|
||||
|
||||
unset($_POST['ticket_cc_id']);
|
||||
require_once 'ticket_cc_find.php';
|
||||
|
||||
if ($ticket) {
|
||||
|
||||
if ($cc_locked) {
|
||||
apiFormRefuse($cc_locked);
|
||||
}
|
||||
$emails = ticketCcEmailsValid($_POST['ticket_cc_email'] ?? '', $cc_bad);
|
||||
if ($emails === null) {
|
||||
apiFormRefuse("ticket_cc_email has '$cc_bad', which isn't an email address");
|
||||
}
|
||||
if (!$emails) {
|
||||
apiFormRefuse('ticket_cc_email is needed - an email address, or several');
|
||||
}
|
||||
|
||||
$ticket_id = intval($ticket['ticket_id']);
|
||||
$reference = ticketReference($ticket);
|
||||
|
||||
$added = ticketAddCcs($ticket_id, $emails);
|
||||
if (!$added) {
|
||||
apiFormRefuse('No new CCs - ' . implode(', ', $emails) . (count($emails) === 1 ? ' is' : ' are') . " CC'd on ticket $reference already, or ITFlow's own");
|
||||
}
|
||||
|
||||
// Each one added, with its id - to take them off again
|
||||
$added_sql = implode(',', array_map(function ($email) { return "'" . escapeSql($email) . "'"; }, $added));
|
||||
$added_rows = [];
|
||||
$sql = mysqli_query($mysqli, "SELECT ticket_cc_id, ticket_cc_email FROM ticket_ccs WHERE ticket_cc_ticket_id = $ticket_id AND ticket_cc_email IN ($added_sql) ORDER BY ticket_cc_id");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$added_rows[] = ['ticket_cc_id' => intval($row['ticket_cc_id']), 'ticket_cc_email' => $row['ticket_cc_email']];
|
||||
}
|
||||
$insert_id = $added_rows[0]['ticket_cc_id'] ?? false;
|
||||
$return_arr['added'] = $added_rows;
|
||||
|
||||
// Each told, when asked and ITFlow sends email - as the box on Add CC, shown only then
|
||||
$notified = 0;
|
||||
if (intval($_POST['ticket_cc_notify'] ?? 0) === 1 && !empty($config_smtp_provider)) {
|
||||
$notified = ticketMailCcsAdded($ticket_id, $added, stripslashes($session_name));
|
||||
}
|
||||
$return_arr['notified'] = $notified;
|
||||
|
||||
$reference_sql = escapeSql($reference);
|
||||
foreach ($added as $cc_email) {
|
||||
$cc_email_sql = escapeSql($cc_email);
|
||||
logTicketHistory($ticket_id, "$session_name added $cc_email_sql as a CC via the API ($api_key_name)");
|
||||
logAudit("Ticket", "Edit", "Added $cc_email_sql as a CC on ticket $reference_sql via API ($api_key_name)", $client_id, $ticket_id);
|
||||
}
|
||||
logAudit("API", "Success", "Added " . count($added) . " CC(s) to ticket $reference_sql via API ($api_key_name)", $client_id);
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once '../create_output.php';
|
||||
58
api/v1/ticket_ccs/delete.php
Normal file
58
api/v1/ticket_ccs/delete.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/*
|
||||
* API - Ticket CCs - Delete
|
||||
* POST /api/v1/ticket_ccs/delete.php
|
||||
*
|
||||
* Take a CC off a ticket, as the x beside them on its page does - they get no
|
||||
* more of its emails. Needs Modify on Support, as on the page, not Full. Not on
|
||||
* a closed ticket.
|
||||
*
|
||||
* Parameters (POST, JSON body):
|
||||
* api_key required - Your API key
|
||||
* ticket_cc_id The CC - this, or ticket_id and ticket_cc_email
|
||||
* ticket_id, ticket_cc_email The ticket, and the CC's email address
|
||||
* client_id the ticket's client - needed when the key's user is limited to
|
||||
* certain clients
|
||||
*/
|
||||
|
||||
require_once '../validate_api_key.php';
|
||||
require_once '../require_post_method.php';
|
||||
|
||||
$delete_count = false;
|
||||
|
||||
require_once 'ticket_cc_find.php';
|
||||
|
||||
// By the ticket and the address, without the CC's id
|
||||
if ($ticket && !$cc_row && empty($_POST['ticket_cc_id'])) {
|
||||
$cc_email = strtolower(trim(is_scalar($_POST['ticket_cc_email'] ?? '') ? (string) ($_POST['ticket_cc_email'] ?? '') : ''));
|
||||
if ($cc_email === '') {
|
||||
apiFormRefuse('ticket_cc_id is needed, or ticket_id and ticket_cc_email');
|
||||
}
|
||||
$cc_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT ticket_cc_id, ticket_cc_name, ticket_cc_email, ticket_cc_ticket_id FROM ticket_ccs
|
||||
WHERE ticket_cc_ticket_id = " . intval($ticket['ticket_id']) . " AND ticket_cc_email = '" . escapeSql($cc_email) . "' LIMIT 1"));
|
||||
if (!$cc_row) {
|
||||
apiFormRefuse("$cc_email isn't a CC on ticket " . ticketReference($ticket));
|
||||
}
|
||||
}
|
||||
|
||||
if ($ticket && $cc_row) {
|
||||
|
||||
if ($cc_locked) {
|
||||
apiFormRefuse($cc_locked);
|
||||
}
|
||||
|
||||
$ticket_id = intval($ticket['ticket_id']);
|
||||
mysqli_query($mysqli, "DELETE FROM ticket_ccs WHERE ticket_cc_id = " . intval($cc_row['ticket_cc_id']));
|
||||
$delete_count = mysqli_affected_rows($mysqli);
|
||||
|
||||
if ($delete_count > 0) {
|
||||
$cc_email_sql = escapeSql($cc_row['ticket_cc_email']);
|
||||
$reference_sql = escapeSql(ticketReference($ticket));
|
||||
logTicketHistory($ticket_id, "$session_name removed $cc_email_sql as a CC via the API ($api_key_name)");
|
||||
logAudit("Ticket", "Edit", "Removed $cc_email_sql as a CC on ticket $reference_sql via API ($api_key_name)", $client_id, $ticket_id);
|
||||
logAudit("API", "Success", "Removed $cc_email_sql as a CC on ticket $reference_sql via API ($api_key_name)", $client_id);
|
||||
}
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once '../delete_output.php';
|
||||
34
api/v1/ticket_ccs/read.php
Normal file
34
api/v1/ticket_ccs/read.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/*
|
||||
* API - Ticket CCs - Read
|
||||
* GET /api/v1/ticket_ccs/read.php
|
||||
*
|
||||
* A ticket's CCs - the people copied in on every email about it, whose replies
|
||||
* count as the client's - as they were added, or one CC.
|
||||
*
|
||||
* ticket_id This ticket's CCs - this or ticket_cc_id is needed
|
||||
* ticket_cc_id Just this CC
|
||||
* client_id optional - Only if the ticket is this client's
|
||||
*/
|
||||
|
||||
require_once '../validate_api_key.php';
|
||||
require_once '../require_get_method.php';
|
||||
|
||||
$ticket_id = intval($_GET['ticket_id'] ?? 0);
|
||||
$cc_id = intval($_GET['ticket_cc_id'] ?? 0);
|
||||
|
||||
if (!$ticket_id && !$cc_id) {
|
||||
http_response_code(400);
|
||||
$return_arr['success'] = "False";
|
||||
$return_arr['message'] = "ticket_ccs/read.php needs ticket_id or ticket_cc_id.";
|
||||
echo json_encode($return_arr);
|
||||
exit();
|
||||
}
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT ticket_ccs.*, ticket_prefix, ticket_number, ticket_client_id
|
||||
FROM ticket_ccs JOIN tickets ON ticket_id = ticket_cc_ticket_id
|
||||
WHERE " . ($cc_id ? "ticket_cc_id = $cc_id" : "ticket_cc_ticket_id = $ticket_id") . " " . apiClientScopeSql('ticket_client_id') . "
|
||||
ORDER BY ticket_cc_id");
|
||||
|
||||
// Output
|
||||
require_once "../read_output.php";
|
||||
29
api/v1/ticket_ccs/ticket_cc_find.php
Normal file
29
api/v1/ticket_ccs/ticket_cc_find.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
// The ticket a request names (ticket_id), or the CC (ticket_cc_id) and its ticket - of a client
|
||||
// the key's user can reach, and client_id's when it is sent - as $ticket and $cc_row (null when
|
||||
// not found). $client_id becomes the ticket's client. A closed ticket keeps its CCs as they are,
|
||||
// as on its page - $cc_locked says why.
|
||||
|
||||
if (!function_exists('apiDeny')) {
|
||||
http_response_code(404);
|
||||
exit();
|
||||
}
|
||||
|
||||
require_once '../form_input.php';
|
||||
|
||||
$cc_row = !empty($_POST['ticket_cc_id']) ? mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT ticket_cc_id, ticket_cc_name, ticket_cc_email, ticket_cc_ticket_id
|
||||
FROM ticket_ccs WHERE ticket_cc_id = " . intval($_POST['ticket_cc_id']))) : null;
|
||||
$cc_ticket_id = $cc_row ? intval($cc_row['ticket_cc_ticket_id']) : intval($_POST['ticket_id'] ?? 0);
|
||||
$ticket = $cc_ticket_id ? mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticket_number, ticket_subject, ticket_status, ticket_client_id, ticket_closed_at
|
||||
FROM tickets WHERE ticket_id = $cc_ticket_id " . clientScopeSql('ticket_client_id') . ($client_id ? " AND ticket_client_id = $client_id" : '') . " LIMIT 1")) : null;
|
||||
|
||||
$cc_locked = '';
|
||||
if ($ticket) {
|
||||
$client_id = intval($ticket['ticket_client_id']);
|
||||
if (!empty($ticket['ticket_closed_at']) || intval($ticket['ticket_status']) === TICKET_STATUS_CLOSED) {
|
||||
$cc_locked = 'Ticket ' . ticketReference($ticket) . ' is closed - its CCs stay as they are';
|
||||
}
|
||||
} else {
|
||||
$cc_row = null;
|
||||
}
|
||||
@@ -12,8 +12,11 @@
|
||||
* starts it in an open status of your choosing - On Hold, say - and
|
||||
* ticket_invoice_id ties it to one of the client's invoices: once that is paid
|
||||
* in full the ticket gets a note, goes from On Hold back to Open, and its agent
|
||||
* is told (invoicePaidFollowUp()). The answer has the ticket's number as people
|
||||
* see it and where its contact opens it.
|
||||
* is told (invoicePaidFollowUp()). ticket_ccs are its CCs, as New Ticket's CC
|
||||
* field - email addresses, a list or one string separated by commas - on it
|
||||
* before anyone is told, so ticket_notify's email goes to them too. The answer
|
||||
* has the ticket's number as people see it, where its contact opens it, and the
|
||||
* CCs added when ticket_ccs was sent.
|
||||
*/
|
||||
|
||||
require_once '../validate_api_key.php';
|
||||
@@ -97,6 +100,15 @@ if ($invoice_link && (!$client_id || !mysqli_num_rows(mysqli_query($mysqli, "SEL
|
||||
$ticket_refuse("ticket_invoice_id $invoice_link isn't one of this client's invoices.");
|
||||
}
|
||||
|
||||
// Its CCs, as New Ticket's CC field - each an email address, or it isn't raised
|
||||
$ccs_posted = null;
|
||||
if (array_key_exists('ticket_ccs', $_POST)) {
|
||||
$ccs_posted = ticketCcEmailsValid($_POST['ticket_ccs'], $cc_bad);
|
||||
if ($ccs_posted === null) {
|
||||
$ticket_refuse("ticket_ccs has '$cc_bad', which isn't an email address - send a list of addresses, or one string separated by commas.");
|
||||
}
|
||||
}
|
||||
|
||||
// A client that exists, or none (internal work)
|
||||
$client_exists = !$client_id || mysqli_num_rows(mysqli_query($mysqli, "SELECT 1 FROM clients WHERE client_id = " . intval($client_id)));
|
||||
|
||||
@@ -148,6 +160,9 @@ if (!empty($subject) && $client_exists) {
|
||||
// Pictures in its details as data kept as its files (functions/ticket_pictures.php)
|
||||
ticketPicturesSaveTicket($insert_id);
|
||||
|
||||
// Its CCs - on it before anyone is told, so its first email copies them in. Never ITFlow's own addresses.
|
||||
$ccs_added = $ccs_posted ? ticketAddCcs($insert_id, $ccs_posted) : [];
|
||||
|
||||
// Part of a project
|
||||
$project = $ticket_project_id ? projectRow($ticket_project_id) : null;
|
||||
if ($project) {
|
||||
@@ -173,6 +188,9 @@ if (!empty($subject) && $client_exists) {
|
||||
$new_row = ticketRow($insert_id);
|
||||
$return_arr['ticket_reference'] = ticketReference($new_row);
|
||||
$return_arr['ticket_url'] = ticketEmailUrl($new_row);
|
||||
if ($ccs_posted !== null) {
|
||||
$return_arr['ticket_ccs'] = $ccs_added;
|
||||
}
|
||||
if ($template) {
|
||||
$return_arr['ticket_tasks'] = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM tasks WHERE task_ticket_id = " . intval($insert_id)))[0]);
|
||||
}
|
||||
|
||||
@@ -22,5 +22,6 @@ if (isset($_GET['ticket_id'])) {
|
||||
|
||||
// Output
|
||||
$api_tag_entity = 'ticket'; // each one's tags
|
||||
$api_ticket_ccs = true; // and its CCs
|
||||
require_once "../read_output.php";
|
||||
|
||||
|
||||
@@ -247,6 +247,46 @@ function ticketCcEmails($input) {
|
||||
return array_keys($emails);
|
||||
}
|
||||
|
||||
/**
|
||||
* ticketCcEmails() for the API, where an address that is wrong is said so rather than left out - the list, or null
|
||||
* with $bad the first entry that isn't an email address. $input is a list, or one string separated by commas,
|
||||
* semicolons or spaces.
|
||||
*/
|
||||
function ticketCcEmailsValid($input, &$bad = '') {
|
||||
$list = is_array($input) ? $input : preg_split('/[\s,;]+/', is_scalar($input) ? (string) $input : '');
|
||||
foreach ($list as $email) {
|
||||
if (!is_scalar($email) && $email !== null) {
|
||||
$bad = 'a list inside the list';
|
||||
return null;
|
||||
}
|
||||
$email = trim((string) $email);
|
||||
if ($email !== '' && !filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
$bad = $email;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return ticketCcEmails($list);
|
||||
}
|
||||
|
||||
/** Each ticket's CCs on its row, as ticket_ccs - their ticket_cc_id, ticket_cc_name and ticket_cc_email, as they were added. For the API's ticket read (api/v1/read_output.php). */
|
||||
function ticketCcsApiAttach(array $rows) {
|
||||
global $mysqli;
|
||||
$ids = array_unique(array_filter(array_map('intval', array_column($rows, 'ticket_id'))));
|
||||
$ccs = [];
|
||||
if ($ids) {
|
||||
$sql = mysqli_query($mysqli, "SELECT ticket_cc_id, ticket_cc_name, ticket_cc_email, ticket_cc_ticket_id FROM ticket_ccs
|
||||
WHERE ticket_cc_ticket_id IN (" . implode(',', $ids) . ") ORDER BY ticket_cc_id");
|
||||
while ($sql && ($cc = mysqli_fetch_assoc($sql))) {
|
||||
$ccs[intval($cc['ticket_cc_ticket_id'])][] = ['ticket_cc_id' => intval($cc['ticket_cc_id']), 'ticket_cc_name' => $cc['ticket_cc_name'], 'ticket_cc_email' => $cc['ticket_cc_email']];
|
||||
}
|
||||
}
|
||||
foreach ($rows as &$row) {
|
||||
$row['ticket_ccs'] = $ccs[intval($row['ticket_id'] ?? 0)] ?? [];
|
||||
}
|
||||
unset($row);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/** Add CCs a ticket doesn't have already - the ones added. Never one of ITFlow's own addresses (emailOwnAddresses()). */
|
||||
function ticketAddCcs($ticket_id, array $emails) {
|
||||
global $mysqli;
|
||||
|
||||
Reference in New Issue
Block a user