Add custom event handler to be triggered by some actions affecting tickets/quotes/invoices/contacts

This commit is contained in:
wrongecho
2024-10-02 11:26:13 +01:00
parent c352f6e3cb
commit 1c404b9cf1
12 changed files with 161 additions and 17 deletions

View File

@@ -23,6 +23,8 @@ if (isset($_GET['accept_quote'], $_GET['url_key'])) {
mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Accepted', history_description = 'Client accepted Quote!', history_quote_id = $quote_id");
customAction('quote_accept', $quote_id);
$_SESSION['alert_message'] = "Quote Accepted";
header("Location: " . $_SERVER["HTTP_REFERER"]);
@@ -45,6 +47,8 @@ if (isset($_GET['decline_quote'], $_GET['url_key'])) {
mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Declined', history_description = 'Client declined Quote!', history_quote_id = $quote_id");
customAction('quote_decline', $quote_id);
$_SESSION['alert_type'] = "danger";
$_SESSION['alert_message'] = "Quote Declined";
@@ -73,6 +77,8 @@ if (isset($_GET['reopen_ticket'], $_GET['url_key'])) {
//Logging
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Ticket', log_action = 'Replied', log_description = '$ticket_id reopened by client (guest)', log_ip = '$session_ip', log_user_agent = '$session_user_agent'");
customAction('ticket_update', $ticket_id);
$_SESSION['alert_message'] = "Ticket reopened";
header("Location: " . $_SERVER["HTTP_REFERER"]);
@@ -100,6 +106,8 @@ if (isset($_GET['close_ticket'], $_GET['url_key'])) {
//Logging
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Ticket', log_action = 'Replied', log_description = '$ticket_id closed by client (guest)', log_ip = '$session_ip', log_user_agent = '$session_user_agent'");
customAction('ticket_close', $ticket_id);
$_SESSION['alert_message'] = "Ticket closed";
header("Location: " . $_SERVER["HTTP_REFERER"]);
@@ -130,6 +138,8 @@ if (isset($_GET['add_ticket_feedback'], $_GET['url_key'])) {
$_SESSION['alert_message'] = "Feedback recorded - thank you";
header("Location: " . $_SERVER["HTTP_REFERER"]);
customAction('ticket_feedback', $ticket_id);
} else {
echo "Invalid!!";
}