From 9d540f4bfe959878b303f86d1c952190dba97710 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 14 Jul 2026 17:43:55 -0400 Subject: [PATCH] Replace Function customAction() with triggerCustomAction() --- agent/ajax.php | 8 ++--- agent/post/client.php | 2 +- agent/post/contact.php | 6 ++-- agent/post/invoice.php | 4 +-- agent/post/payment.php | 10 +++--- agent/post/quote.php | 10 +++--- agent/post/recurring_invoice.php | 2 +- agent/post/recurring_ticket.php | 12 +++---- agent/post/ticket.php | 50 +++++++++++++++--------------- api/v1/tickets/resolve.php | 2 +- client/post.php | 18 +++++------ cron/cron.php | 8 ++--- cron/ticket_email_parser.php | 6 ++-- functions/logging.php | 2 +- guest/guest_pay_invoice_stripe.php | 2 +- guest/guest_post.php | 10 +++--- 16 files changed, 76 insertions(+), 76 deletions(-) diff --git a/agent/ajax.php b/agent/ajax.php index 97519245..3d100bd9 100644 --- a/agent/ajax.php +++ b/agent/ajax.php @@ -478,16 +478,16 @@ if (isset($_POST['update_kanban_ticket'])) { if ($oldStatus === false) { // if ticket was not moved, just uptdate the order on kanban mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban WHERE ticket_id = $ticket_id"); - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); } else { // If the ticket was moved from a resolved status to another status, we need to update ticket_resolved_at if ($oldStatus === $statuses['Resolved']) { mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban, ticket_status = $status, ticket_resolved_at = NULL WHERE ticket_id = $ticket_id"); - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); } elseif ($status === $statuses['Resolved']) { // If the ticket was moved to a resolved status, we need to update ticket_resolved_at mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban, ticket_status = $status, ticket_resolved_at = NOW() WHERE ticket_id = $ticket_id"); - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); // Client notification email if (!empty($config_smtp_host) && $config_ticket_client_general_notifications == 1) { @@ -567,7 +567,7 @@ if (isset($_POST['update_kanban_ticket'])) { } else { // If the ticket was moved from any status to another status mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban, ticket_status = $status WHERE ticket_id = $ticket_id"); - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); } } diff --git a/agent/post/client.php b/agent/post/client.php index 02c06416..88eb3b30 100644 --- a/agent/post/client.php +++ b/agent/post/client.php @@ -870,7 +870,7 @@ if (isset($_POST['bulk_add_client_ticket'])) { } // Custom action/notif handler - customAction('ticket_create', $ticket_id); + triggerCustomAction('ticket_create', $ticket_id); } logAudit("Ticket", "Bulk Create", "$session_name created $client_count tickets for $client_name"); diff --git a/agent/post/contact.php b/agent/post/contact.php index 028a7065..ce320344 100644 --- a/agent/post/contact.php +++ b/agent/post/contact.php @@ -74,7 +74,7 @@ if (isset($_POST['add_contact'])) { logAudit("Contact", "Create", "$session_name created contact $name", $client_id, $contact_id); - customAction('contact_create', $contact_id); + triggerCustomAction('contact_create', $contact_id); flashAlert("Contact $name created"); @@ -219,7 +219,7 @@ if (isset($_POST['edit_contact'])) { logAudit("Contact", "Edit", "$session_name edited contact $name", $client_id, $contact_id); - customAction('contact_update', $contact_id); + triggerCustomAction('contact_update', $contact_id); flashAlert("Contact $name updated"); @@ -498,7 +498,7 @@ if (isset($_POST['bulk_edit_contact_role'])) { logAudit("Contact", "Edit", "$session_name updated the contact role for $contact_name", $client_id, $contact_id); - customAction('contact_update', $contact_id); + triggerCustomAction('contact_update', $contact_id); } // End Assign Location Loop diff --git a/agent/post/invoice.php b/agent/post/invoice.php index 6a5c2d27..48490c8c 100644 --- a/agent/post/invoice.php +++ b/agent/post/invoice.php @@ -45,7 +45,7 @@ if (isset($_POST['add_invoice'])) { logAudit("Invoice", "Create", "$session_name created Invoice $config_invoice_prefix$invoice_number - $scope", $client_id, $invoice_id); - customAction('invoice_create', $invoice_id); + triggerCustomAction('invoice_create', $invoice_id); flashAlert("Invoice $config_invoice_prefix$invoice_number created"); @@ -156,7 +156,7 @@ if (isset($_POST['add_invoice_copy'])) { logAudit("Invoice", "Create", "$session_name created new Invoice $config_invoice_prefix$new_invoice_number from $old_invoice_prefix$old_invoice_prefix", $client_id, $new_invoice_id); - customAction('invoice_create', $new_invoice_id); + triggerCustomAction('invoice_create', $new_invoice_id); flashAlert("Created new Invoice $config_invoice_prefix$new_invoice_number from $old_invoice_prefix$old_invoice_prefix"); diff --git a/agent/post/payment.php b/agent/post/payment.php index fdab76d8..24cacf91 100644 --- a/agent/post/payment.php +++ b/agent/post/payment.php @@ -166,7 +166,7 @@ if (isset($_POST['add_payment'])) { logAudit("Invoice", "Payment", "Payment amount of " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . " added to invoice $invoice_prefix$invoice_number", $client_id, $invoice_id); - customAction('invoice_pay', $invoice_id); + triggerCustomAction('invoice_pay', $invoice_id); flashAlert("Payment amount " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . " added"); @@ -307,7 +307,7 @@ if (isset($_POST['apply_credit'])) { logAudit("Invoice", "Payment", "Credit " . numfmt_format_currency($currency_format, $amount, $session_company_currency) . " applied to invoice $invoice_prefix$invoice_number", $client_id, $invoice_id); - customAction('invoice_pay', $invoice_id); + triggerCustomAction('invoice_pay', $invoice_id); flashAlert("Credit amount " . numfmt_format_currency($currency_format, $amount, $session_company_currency) . " applied"); @@ -497,7 +497,7 @@ if (isset($_POST['add_payment_stripe'])) { // Notify/log appNotify("Invoice Paid", "Invoice $invoice_prefix$invoice_number automatically paid", "/agent/invoice.php?invoice_id=$invoice_id", $client_id); logAudit("Invoice", "Payment", "$session_name initiated Stripe payment amount of " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added to invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc", $client_id, $invoice_id); - customAction('invoice_pay', $invoice_id); + triggerCustomAction('invoice_pay', $invoice_id); flashAlert("Payment amount " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added"); @@ -682,7 +682,7 @@ if (isset($_GET['add_payment_stripe'])) { // Notify/log appNotify("Invoice Paid", "Invoice $invoice_prefix$invoice_number automatically paid", "invoice.php?invoice_id=$invoice_id", $client_id); logAudit("Invoice", "Payment", "$session_name initiated Stripe payment amount of " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added to invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc", $client_id, $invoice_id); - customAction('invoice_pay', $invoice_id); + triggerCustomAction('invoice_pay', $invoice_id); flashAlert("Payment amount " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added"); @@ -783,7 +783,7 @@ if (isset($_POST['add_bulk_payment'])) { // Add to Email Body Invoice Portion $email_body_invoices .= "
Invoice $invoice_prefix$invoice_number - Outstanding Amount: " . numfmt_format_currency($currency_format, $invoice_balance, $currency_code) . " - Payment Applied: " . numfmt_format_currency($currency_format, $payment_amount, $currency_code) . " - New Balance: " . numfmt_format_currency($currency_format, $remaining_invoice_balance, $currency_code); - customAction('invoice_pay', $invoice_id); + triggerCustomAction('invoice_pay', $invoice_id); } // End Invoice Loop diff --git a/agent/post/quote.php b/agent/post/quote.php index 73b279a5..13046a0f 100644 --- a/agent/post/quote.php +++ b/agent/post/quote.php @@ -40,7 +40,7 @@ if (isset($_POST['add_quote'])) { logAudit("Quote", "Create", "$session_name created quote $config_quote_prefix$quote_number", $client_id, $quote_id); - customAction('quote_create', $quote_id); + triggerCustomAction('quote_create', $quote_id); flashAlert("Quote $config_quote_prefix$quote_number created"); @@ -112,7 +112,7 @@ if (isset($_POST['add_quote_copy'])) { logAudit("Quote", "Create", "$session_name created quote $config_quote_prefix$quote_number from quote $original_quote_prefix$original_quote_number", $client_id, $new_quote_id); - customAction('quote_create', $new_quote_id); + triggerCustomAction('quote_create', $new_quote_id); flashAlert("Quote copied"); @@ -205,7 +205,7 @@ if (isset($_POST['add_quote_to_invoice'])) { mysqli_query($mysqli, "UPDATE tickets SET ticket_invoice_id = $new_invoice_id WHERE ticket_id = $ticket_id AND ticket_invoice_id = '0'"); // Only if ticket doesn't already have an invoice } - customAction('invoice_create', $new_invoice_id); + triggerCustomAction('invoice_create', $new_invoice_id); flashAlert("Invoice created from quote $quote_prefix$quote_number"); @@ -532,7 +532,7 @@ if (isset($_GET['accept_quote'])) { logAudit("Quote", "Edit", "$session_name marked quote $quote_prefix$quote_number as accepted", $client_id, $quote_id); - customAction('quote_accept', $quote_id); + triggerCustomAction('quote_accept', $quote_id); flashAlert("Quote accepted"); @@ -560,7 +560,7 @@ if (isset($_GET['decline_quote'])) { mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Cancelled', history_description = 'Quote declined by $session_name', history_quote_id = $quote_id"); - customAction('quote_decline', $quote_id); + triggerCustomAction('quote_decline', $quote_id); logAudit("Quote", "Edit", "$session_name marked quote $quote_prefix$quote_number as declined", $client_id, $quote_id); diff --git a/agent/post/recurring_invoice.php b/agent/post/recurring_invoice.php index 7b9c7eb6..6798fef7 100644 --- a/agent/post/recurring_invoice.php +++ b/agent/post/recurring_invoice.php @@ -540,7 +540,7 @@ if (isset($_GET['force_recurring'])) { logAudit("Invoice", "Create", "$session_name forced recurring invoice into an invoice", $client_id, $new_invoice_id); - customAction('invoice_create', $new_invoice_id); + triggerCustomAction('invoice_create', $new_invoice_id); flashAlert("Recurring Invoice Forced"); diff --git a/agent/post/recurring_ticket.php b/agent/post/recurring_ticket.php index f5f0e377..0b3c3e71 100644 --- a/agent/post/recurring_ticket.php +++ b/agent/post/recurring_ticket.php @@ -140,7 +140,7 @@ if (isset($_POST['bulk_force_recurring_tickets'])) { // Notifications - customAction('ticket_create', $id); + triggerCustomAction('ticket_create', $id); // Get client/contact/ticket details $sql = mysqli_query( @@ -280,7 +280,7 @@ if (isset($_GET['force_recurring_ticket'])) { // Notifications - customAction('ticket_create', $id); + triggerCustomAction('ticket_create', $id); // Get client/contact/ticket details $sql = mysqli_query( @@ -548,7 +548,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_priority'])) { logAudit("Ticket", "Edit", "$session_name updated the priority on recurring ticket $ticket_subject from $original_recurring_ticket_priority to $priority", $client_id, $recurring_ticket_id); - customAction('recurring_ticket_update', $recurring_ticket_id); + triggerCustomAction('recurring_ticket_update', $recurring_ticket_id); } // End For Each Recurring Ticket ID Loop logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the priority to $priority on $recurring_ticket_count Recurring Tickets"); @@ -590,7 +590,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_category'])) { logAudit("Recurring Ticket", "Edit", "$session_name updated the category on recurring ticket $recurring_ticket_subject from $previous_recurring_ticket_category_name to $category_name", $client_id, $recurring_ticket_id); - customAction('recurring_ticket_update', $recurring_ticket_id); + triggerCustomAction('recurring_ticket_update', $recurring_ticket_id); } logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the category to $category_name for $recurring_ticket_count Recurring Tickets"); @@ -641,7 +641,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_billable'])) { logAudit("Recurring Ticket", "Edit", "$session_name updated the billable status on recurring ticket $recurring_ticket_subject from $previous_billable_status to $billable_status", $client_id, $recurring_ticket_id); - customAction('recurring_ticket_update', $recurring_ticket_id); + triggerCustomAction('recurring_ticket_update', $recurring_ticket_id); } logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the billable status to $billable_status for $recurring_ticket_count Recurring Tickets"); @@ -681,7 +681,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_next_run_date'])) { logAudit("Recurring Ticket", "Edit", "$session_name updated the Next run date on recurring ticket $recurring_ticket_subject from $previous_recurring_ticket_next_run_date to $next_run_date", $client_id, $recurring_ticket_id); - customAction('recurring_ticket_update', $recurring_ticket_id); + triggerCustomAction('recurring_ticket_update', $recurring_ticket_id); } logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the Next run date to $next_run_date for $recurring_ticket_count Recurring Tickets"); diff --git a/agent/post/ticket.php b/agent/post/ticket.php index 6b05352e..7a962b6b 100644 --- a/agent/post/ticket.php +++ b/agent/post/ticket.php @@ -186,7 +186,7 @@ if (isset($_POST['add_ticket'])) { } // Custom action/notif handler - customAction('ticket_create', $ticket_id); + triggerCustomAction('ticket_create', $ticket_id); logAudit("Ticket", "Create", "$session_name created ticket $config_ticket_prefix$ticket_number - $ticket_subject", $client_id, $ticket_id); @@ -304,7 +304,7 @@ if (isset($_POST['edit_ticket'])) { } // Custom action/notif handler - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); logAudit("Ticket", "Edit", "$session_name edited ticket $ticket_prefix$ticket_number", $client_id, $ticket_id); @@ -350,7 +350,7 @@ if (isset($_POST['edit_ticket_priority'])) { logAudit("Ticket", "Edit", "$session_name changed priority from $original_priority to $priority for ticket $ticket_prefix$ticket_number", $client_id, $ticket_id); - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); flashAlert("Priority updated from $original_priority to $priority"); @@ -436,7 +436,7 @@ if (isset($_POST['edit_ticket_contact'])) { } // Custom action/notif handler - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); // Update Ticket History mysqli_query($mysqli, "INSERT INTO ticket_history SET ticket_history_status = '$ticket_status', ticket_history_description = '$session_name changed the contact from $original_contact_name to $contact_name', ticket_history_ticket_id = $ticket_id"); @@ -839,7 +839,7 @@ if (isset($_POST['assign_ticket'])) { } } - customAction('ticket_assign', $ticket_id); + triggerCustomAction('ticket_assign', $ticket_id); flashAlert("Ticket $ticket_prefix$ticket_number assigned to $agent_name"); @@ -892,7 +892,7 @@ if (isset($_GET['delete_ticket'])) { flashAlert("Ticket $ticket_prefix$ticket_number along with all replies deleted", 'error'); - customAction('ticket_delete', $ticket_id); + triggerCustomAction('ticket_delete', $ticket_id); redirect("tickets.php"); } @@ -1013,7 +1013,7 @@ if (isset($_POST['bulk_assign_ticket'])) { logAudit("Ticket", "Edit", "$session_name reassigned ticket $ticket_prefix$ticket_number to $agent_name", $client_id, $ticket_id); - customAction('ticket_assign', $ticket_id); + triggerCustomAction('ticket_assign', $ticket_id); $tickets_assigned_body .= "$ticket_prefix$ticket_number - $ticket_subject
"; } // End For Each Ticket ID Loop @@ -1097,7 +1097,7 @@ if (isset($_POST['bulk_edit_ticket_priority'])) { logAudit("Ticket", "Edit", "$session_name updated the priority on ticket $ticket_prefix$ticket_number - $ticket_subject from $original_ticket_priority to $priority", $client_id, $ticket_id); - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); } // End For Each Ticket ID Loop logAudit("Ticket", " Bulk Edit", "$session_name updated the priority on $ticket_count"); @@ -1149,7 +1149,7 @@ if (isset($_POST['bulk_edit_ticket_category'])) { logAudit("Ticket", "Edit", "$session_name updated the category on ticket $ticket_prefix$ticket_number - $ticket_subject from $previous_category_name to $category_name", $client_id, $ticket_id); - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); } // End For Each Ticket ID Loop logAudit("Ticket", " Bulk Edit", "$session_name updated the category to $category_name on $ticket_count"); @@ -1220,7 +1220,7 @@ if (isset($_POST['bulk_merge_tickets'])) { logAudit("Ticket", "Merged", "$session_name Merged ticket $ticket_prefix$ticket_number into $ticket_prefix$merge_into_ticket_number", $client_id, $ticket_id); // Custom action/notif handler - customAction('ticket_merge', $ticket_id); + triggerCustomAction('ticket_merge', $ticket_id); } } // End For Each Ticket ID Loop @@ -1297,7 +1297,7 @@ if (isset($_POST['bulk_resolve_tickets'])) { logAudit("Ticket", "Resolve", "$session_name resolved $ticket_prefix$ticket_number - $ticket_subject", $client_id, $ticket_id); - customAction('ticket_resolve', $ticket_id); + triggerCustomAction('ticket_resolve', $ticket_id); // Client notification email if ((!empty($config_smtp_provider)) && $config_ticket_client_general_notifications == 1 && $private_note == 0) { @@ -1444,9 +1444,9 @@ if (isset($_POST['bulk_ticket_reply'])) { // Custom action/notif handler if ($ticket_reply_type == 'Internal') { - customAction('ticket_reply_agent_internal', $ticket_id); + triggerCustomAction('ticket_reply_agent_internal', $ticket_id); } else { - customAction('reply_reply_agent_public', $ticket_id); + triggerCustomAction('reply_reply_agent_public', $ticket_id); } // Resolve the ticket, if set @@ -1456,7 +1456,7 @@ if (isset($_POST['bulk_ticket_reply'])) { // Logging logAudit("Ticket", "Resolved", "$session_name resolved Ticket $ticket_prefix$ticket_number", $client_id, $ticket_id); - customAction('ticket_resolve', $ticket_id); + triggerCustomAction('ticket_resolve', $ticket_id); } // Get Contact Details @@ -1710,7 +1710,7 @@ if (isset($_POST['bulk_add_asset_ticket'])) { } // Custom action/notif handler - customAction('ticket_create', $ticket_id); + triggerCustomAction('ticket_create', $ticket_id); } logAudit("Ticket", "Bulk Create", "$session_name created $asset_count tickets for $asset_count"); @@ -1890,9 +1890,9 @@ if (isset($_POST['add_ticket_reply'])) { // Custom action/notif handler if ($ticket_reply_type == 'Internal') { - customAction('ticket_reply_agent_internal', $ticket_id); + triggerCustomAction('ticket_reply_agent_internal', $ticket_id); } else { - customAction('reply_reply_agent_public', $ticket_id); + triggerCustomAction('reply_reply_agent_public', $ticket_id); } flashAlert("Ticket $ticket_prefix$ticket_number has been updated with your reply and was $ticket_reply_type"); @@ -2059,7 +2059,7 @@ if (isset($_POST['merge_ticket'])) { logAudit("Ticket", "Merged", "$session_name Merged ticket $ticket_prefix$ticket_number into $ticket_prefix$merge_into_ticket_number"); - customAction('ticket_merge', $ticket_id); + triggerCustomAction('ticket_merge', $ticket_id); flashAlert("Ticket merged into $ticket_prefix$merge_into_ticket_number"); @@ -2090,7 +2090,7 @@ if (isset($_POST['change_client_ticket'])) { logAudit("Ticket", "Change", "$session_name changed ticket client", $client_id, $ticket_id); - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); flashAlert("Ticket client updated"); @@ -2128,7 +2128,7 @@ if (isset($_GET['resolve_ticket'])) { logAudit("Ticket", "Resolved", "$session_name resolved ticket $ticket_prefix$ticket_number (ID: $ticket_id)", $client_id, $ticket_id); - customAction('ticket_resolve', $ticket_id); + triggerCustomAction('ticket_resolve', $ticket_id); // Client notification email if ((!empty($config_smtp_provider)) && $config_ticket_client_general_notifications == 1) { @@ -2230,7 +2230,7 @@ if (isset($_GET['close_ticket'])) { logAudit("Ticket", "Closed", "$session_name closed ticket ID $ticket_id", $client_id, $ticket_id); - customAction('ticket_close', $ticket_id); + triggerCustomAction('ticket_close', $ticket_id); // Client notification email if ((!empty($config_smtp_provider)) && $config_ticket_client_general_notifications == 1) { @@ -2328,7 +2328,7 @@ if (isset($_GET['reopen_ticket'])) { logAudit("Ticket", "Reopened", "$session_name reopened ticket ID $ticket_id", $client_id, $ticket_id); - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); flashAlert("Ticket re-opened"); @@ -2525,7 +2525,7 @@ if (isset($_POST['add_quote_from_ticket'])) { mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Draft', history_description = 'Quote created from Ticket $ticket_prefix$ticket_number!', history_quote_id = $quote_id"); logAudit("Quote", "Create", "$session_name created quote $config_quote_prefix$quote_number from ticket $ticket_prefix$ticket_number", $client_id, $quote_id); - customAction('quote_create', $quote_id); + triggerCustomAction('quote_create', $quote_id); flashAlert("Quote $config_quote_prefix$quote_number created"); redirect("quote.php?quote_id=$quote_id"); @@ -2789,7 +2789,7 @@ if (isset($_POST['edit_ticket_schedule'])) { logAudit("Ticket", "Edit", "$session_name edited ticket schedule", $client_id, $ticket_id); - customAction('ticket_schedule', $ticket_id); + triggerCustomAction('ticket_schedule', $ticket_id); if (empty($conflicting_tickets)) { flashAlert("Ticket scheduled for $email_datetime"); @@ -2953,7 +2953,7 @@ if (isset($_GET['cancel_ticket_schedule'])) { logAudit("Ticket", "Edit", "$session_name cancelled ticket schedule", $client_id, $ticket_id); - customAction('ticket_unschedule', $ticket_id); + triggerCustomAction('ticket_unschedule', $ticket_id); flashAlert("Ticket schedule cancelled", 'error'); diff --git a/api/v1/tickets/resolve.php b/api/v1/tickets/resolve.php index 1b32c105..6cd2ecf8 100644 --- a/api/v1/tickets/resolve.php +++ b/api/v1/tickets/resolve.php @@ -40,7 +40,7 @@ if (!empty($ticket_id)) { logAudit("API", "Success", "Resolved ticket $ticket_prefix$ticket_number via API ($api_key_name)", $client_id); } - customAction('ticket_resolve', $ticket_id); + triggerCustomAction('ticket_resolve', $ticket_id); } diff --git a/client/post.php b/client/post.php index 13a213c4..268e229f 100644 --- a/client/post.php +++ b/client/post.php @@ -74,7 +74,7 @@ if (isset($_POST['add_ticket'])) { } // Custom action/notif handler - customAction('ticket_create', $ticket_id); + triggerCustomAction('ticket_create', $ticket_id); logAudit("Ticket", "Create", "$session_contact_name created ticket $config_ticket_prefix$ticket_number - $subject from the client portal", $session_client_id, $ticket_id); @@ -178,7 +178,7 @@ if (isset($_POST['add_ticket_comment'])) { } // Custom action/notif handler - customAction('ticket_reply_client', $ticket_id); + triggerCustomAction('ticket_reply_client', $ticket_id); // Redirect back to original page redirect(); @@ -249,7 +249,7 @@ if (isset($_POST['add_ticket_feedback'])) { } // Custom action/notif handler - customAction('ticket_feedback', $ticket_id); + triggerCustomAction('ticket_feedback', $ticket_id); // Redirect redirect(); @@ -284,7 +284,7 @@ if (isset($_GET['resolve_ticket'])) { logAudit("Ticket", "Edit", "$session_contact_name marked ticket $ticket_prefix$ticket_number as resolved in the client portal", $session_client_id, $ticket_id); // Custom action/notif handler - customAction('ticket_resolve', $ticket_id); + triggerCustomAction('ticket_resolve', $ticket_id); redirect("ticket.php?id=" . $ticket_id); @@ -319,7 +319,7 @@ if (isset($_GET['reopen_ticket'])) { logAudit("Ticket", "Edit", "$session_contact_name reopend ticket $ticket_prefix$ticket_number in the client portal", $session_client_id, $ticket_id); // Custom action/notif handler - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); redirect("ticket.php?id=" . $ticket_id); @@ -354,7 +354,7 @@ if (isset($_GET['close_ticket'])) { logAudit("Ticket", "Edit", "$session_contact_name closed ticket $ticket_prefix$ticket_number in the client portal", $session_client_id, $ticket_id); // Custom action/notif handler - customAction('ticket_close', $ticket_id); + triggerCustomAction('ticket_close', $ticket_id); redirect("ticket.php?id=" . $ticket_id); @@ -435,7 +435,7 @@ if (isset($_POST['add_contact'])) { // Logging logAudit("Contact", "Create", "Client contact $session_contact_name created contact $contact_name in the client portal", $session_client_id, $contact_id); - customAction('contact_create', $contact_id); + triggerCustomAction('contact_create', $contact_id); flashAlert("Contact $contact_name created"); @@ -491,7 +491,7 @@ if (isset($_POST['edit_contact'])) { redirect('contacts.php'); - customAction('contact_update', $contact_id); + triggerCustomAction('contact_update', $contact_id); } @@ -678,7 +678,7 @@ if (isset($_GET['add_payment_by_provider'])) { // Notify/log appNotify("Invoice Paid", "Invoice $invoice_prefix$invoice_number automatically paid", "/agent/invoice.php?invoice_id=$invoice_id", $client_id); logAudit("Invoice", "Payment", "$session_name initiated Stripe payment amount of " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added to invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc", $client_id, $invoice_id); - customAction('invoice_pay', $invoice_id); + triggerCustomAction('invoice_pay', $invoice_id); flashAlert("The amount " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " paid Invoice $invoice_prefix$invoice_number"); diff --git a/cron/cron.php b/cron/cron.php index 7ca89046..2c8711bd 100644 --- a/cron/cron.php +++ b/cron/cron.php @@ -349,7 +349,7 @@ if (mysqli_num_rows($sql_recurring_tickets) > 0) { // Logging logAudit("Ticket", "Create", "Cron created recurring scheduled $frequency ticket - $subject", $client_id, $id); - customAction('ticket_create', $id); + triggerCustomAction('ticket_create', $id); // Notifications @@ -483,7 +483,7 @@ while ($row = mysqli_fetch_assoc($sql_resolved_tickets_to_close)) { //Logging logAudit("Ticket", "Closed", "$ticket_prefix$ticket_number auto closed", $client_id, $ticket_id); - customAction('ticket_close', $ticket_id); + triggerCustomAction('ticket_close', $ticket_id); //TODO: Add client notifs if $config_ticket_client_general_notifications is on } @@ -672,7 +672,7 @@ while ($row = mysqli_fetch_assoc($sql_recurring_invoices)) { appNotify("Recurring Sent", "Recurring Invoice $config_invoice_prefix$new_invoice_number for $client_name Sent", "/agent/invoice.php?invoice_id=$new_invoice_id", $client_id); - customAction('invoice_create', $new_invoice_id); + triggerCustomAction('invoice_create', $new_invoice_id); //Update recurring dates @@ -928,7 +928,7 @@ while ($row = mysqli_fetch_assoc($sql_recurring_payments)) { $extended_log_desc = !$pi_livemode ? '(DEV MODE)' : ''; appNotify("Invoice Paid", "Invoice $invoice_prefix$invoice_number automatically paid", "/agent/invoice.php?invoice_id=$invoice_id", $client_id); logAudit("Invoice", "Payment", "Auto Stripe payment amount of " . numfmt_format_currency($currency_format, $invoice_amount, $recurring_payment_currency_code) . " added to invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc", $client_id, $invoice_id); - customAction('invoice_pay', $invoice_id); + triggerCustomAction('invoice_pay', $invoice_id); } else { mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Payment failed', history_description = 'Stripe autopay failed: Status {$payment_intent->status}', history_invoice_id = $invoice_id"); diff --git a/cron/ticket_email_parser.php b/cron/ticket_email_parser.php index 83e3d5b1..17a2ae1a 100644 --- a/cron/ticket_email_parser.php +++ b/cron/ticket_email_parser.php @@ -208,7 +208,7 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date } addToMailQueue($data); - customAction('ticket_create', $id); + triggerCustomAction('ticket_create', $id); return true; } @@ -367,7 +367,7 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac mysqli_query($mysqli, "UPDATE tickets SET ticket_status = 2, ticket_resolved_at = NULL WHERE ticket_id = $ticket_id AND ticket_client_id = $client_id LIMIT 1"); logAudit("Ticket", "Edit", "Email parser: Client contact $from_email_esc updated ticket $config_ticket_prefix$ticket_number_esc ($subject)", $client_id, $ticket_id); - customAction('ticket_reply_client', $ticket_id); + triggerCustomAction('ticket_reply_client', $ticket_id); return true; } else { return false; @@ -856,7 +856,7 @@ foreach ($messages as $message) { $contact_id = mysqli_insert_id($mysqli); logAudit("Contact", "Create", "Email parser: created contact " . mysqli_real_escape_string($mysqli, $contact_name), $client_id, $contact_id); - customAction('contact_create', $contact_id); + triggerCustomAction('contact_create', $contact_id); $email_processed = addTicket($contact_id, $contact_name, $contact_email, $client_id, $date, $subject, $message_body, $attachments, $original_message_file, $ccs); } diff --git a/functions/logging.php b/functions/logging.php index 2ccec999..61ac9803 100644 --- a/functions/logging.php +++ b/functions/logging.php @@ -4,7 +4,7 @@ // Split from the former monolithic functions.php -function customAction($trigger, $entity) { +function triggerCustomAction($trigger, $entity) { $original_dir = getcwd(); // Save chdir(dirname(__FILE__)); diff --git a/guest/guest_pay_invoice_stripe.php b/guest/guest_pay_invoice_stripe.php index d1a1dd5c..1d26881f 100644 --- a/guest/guest_pay_invoice_stripe.php +++ b/guest/guest_pay_invoice_stripe.php @@ -244,7 +244,7 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent // Notify appNotify("Invoice Paid", "Invoice $invoice_prefix$invoice_number has been paid by $client_name - $ip - $os - $browser", "/agent/invoice.php?invoice_id=$invoice_id", $pi_client_id); - customAction('invoice_pay', $invoice_id); + triggerCustomAction('invoice_pay', $invoice_id); $extended_log_desc = ''; if (!$pi_livemode) { diff --git a/guest/guest_post.php b/guest/guest_post.php index 464914a3..3342bb16 100644 --- a/guest/guest_post.php +++ b/guest/guest_post.php @@ -28,7 +28,7 @@ if (isset($_GET['accept_quote'], $_GET['url_key'])) { // Notification appNotify("Quote Accepted", "Quote $quote_prefix$quote_number has been accepted by $client_name", "/agent/quote.php?quote_id=$quote_id", $client_id); - customAction('quote_accept', $quote_id); + triggerCustomAction('quote_accept', $quote_id); // Internal email notification @@ -93,7 +93,7 @@ if (isset($_GET['decline_quote'], $_GET['url_key'])) { // Notification appNotify("Quote Declined", "Quote $quote_prefix$quote_number has been declined by $client_name", "/agent/quote.php?quote_id=$quote_id", $client_id); - customAction('quote_decline', $quote_id); + triggerCustomAction('quote_decline', $quote_id); // Internal email notification @@ -152,7 +152,7 @@ if (isset($_GET['reopen_ticket'], $_GET['url_key'])) { // Add reply mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = 'Ticket reopened by client (guest URL).', ticket_reply_type = 'Internal', ticket_reply_by = 0, ticket_reply_ticket_id = $ticket_id"); - customAction('ticket_update', $ticket_id); + triggerCustomAction('ticket_update', $ticket_id); flashAlert("Ticket reopened"); @@ -180,7 +180,7 @@ if (isset($_GET['close_ticket'], $_GET['url_key'])) { // Add reply mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = 'Ticket closed by client (guest URL).', ticket_reply_type = 'Internal', ticket_reply_by = 0, ticket_reply_ticket_id = $ticket_id"); - customAction('ticket_close', $ticket_id); + triggerCustomAction('ticket_close', $ticket_id); flashAlert("Ticket closed"); @@ -217,7 +217,7 @@ if (isset($_GET['add_ticket_feedback'], $_GET['url_key'])) { redirect(); - customAction('ticket_feedback', $ticket_id); + triggerCustomAction('ticket_feedback', $ticket_id); } else { echo "Invalid!!";