mirror of https://github.com/itflow-org/itflow
Ticket Statuses from DB
First swing at this to share my progress, isn't ready to merge yet but would appreciate thoughts
This commit is contained in:
parent
7702d8c5bf
commit
5e63ef9a2a
|
|
@ -142,14 +142,14 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
|||
$ticket_number = nullable_htmlentities($row['ticket_number']);
|
||||
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
|
||||
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||
$ticket_status = nullable_htmlentities($row['ticket_status']);
|
||||
$ticket_status = sanitizeInput(getTicketStatusName($row['ticket_status']));
|
||||
$ticket_billable = intval($row['ticket_billable']);
|
||||
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
|
||||
$ticket_created_at_time_ago = timeAgo($row['ticket_created_at']);
|
||||
$ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']);
|
||||
$ticket_updated_at_time_ago = timeAgo($row['ticket_updated_at']);
|
||||
if (empty($ticket_updated_at)) {
|
||||
if ($ticket_status == "Closed") {
|
||||
if ($ticket_status == $config_ticket_status_id_closed || $ticket_status == "Closed") {
|
||||
$ticket_updated_at_display = "<p>Never</p>";
|
||||
} else {
|
||||
$ticket_updated_at_display = "<p class='text-danger'>Never</p>";
|
||||
|
|
@ -173,7 +173,7 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
|||
|
||||
$ticket_assigned_to = intval($row['ticket_assigned_to']);
|
||||
if (empty($ticket_assigned_to)) {
|
||||
if ($ticket_status == "Closed") {
|
||||
if ($ticket_status == $config_ticket_status_id_closed || $ticket_status == "Closed") {
|
||||
$ticket_assigned_to_display = "<p>Not Assigned</p>";
|
||||
} else {
|
||||
$ticket_assigned_to_display = "<p class='text-danger'>Not Assigned</p>";
|
||||
|
|
@ -281,7 +281,7 @@ $total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
|||
|
||||
<?php
|
||||
// Edit actions, for open tickets
|
||||
if ($ticket_status !== "Closed") {
|
||||
if ($ticket_status !== $config_ticket_status_id_closed || $ticket_status !== "Closed") {
|
||||
|
||||
require "ticket_assign_modal.php";
|
||||
|
||||
|
|
|
|||
|
|
@ -1687,10 +1687,37 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.3'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.1.3') {
|
||||
// // Insert queries here required to update to DB version 1.1.4
|
||||
if (CURRENT_DATABASE_VERSION == '1.1.3') {
|
||||
|
||||
// Add new ticket_statuses table
|
||||
mysqli_query($mysqli, "CREATE TABLE `ticket_statuses` (
|
||||
`ticket_status_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`ticket_status_name` VARCHAR(200) NOT NULL,
|
||||
`ticket_status_color` VARCHAR(200) NOT NULL,
|
||||
`ticket_status_active` TINYINT(1) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`ticket_status_id`)
|
||||
)");
|
||||
|
||||
// Pre-seed ticket statuses
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'New', ticket_status_color = 'danger'"); // Default ID for new tickets is 1
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Open', ticket_status_color = 'primary'"); // 2
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'On Hold', ticket_status_color = 'success'"); // 3
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Auto Close', ticket_status_color = 'dark'"); // 5
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Closed', ticket_status_color = 'dark'"); // 5
|
||||
|
||||
// Add default values above to settings
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_ticket_status_id_new` int(1) NOT NULL DEFAULT '1' AFTER `config_ticket_new_ticket_notification_email`");
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_ticket_status_id_open` int(1) NOT NULL DEFAULT '2' AFTER `config_ticket_status_id_new`");
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_ticket_status_id_autoclose` int(1) NOT NULL DEFAULT '4' AFTER `config_ticket_status_id_open`");
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_ticket_status_id_closed` int(1) NOT NULL DEFAULT '5' AFTER `config_ticket_status_id_autoclose`");
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.4'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.1.4') {
|
||||
// // Insert queries here required to update to DB version 1.1.5
|
||||
// // Then, update the database to the next sequential version
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.4'");
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.1.5'");
|
||||
// }
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@
|
|||
* It is used in conjunction with database_updates.php
|
||||
*/
|
||||
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.1.3");
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.1.4");
|
||||
|
||||
|
|
|
|||
17
db.sql
17
db.sql
|
|
@ -1296,6 +1296,10 @@ CREATE TABLE `settings` (
|
|||
`config_ticket_autoclose` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`config_ticket_autoclose_hours` int(5) NOT NULL DEFAULT 72,
|
||||
`config_ticket_new_ticket_notification_email` varchar(200) DEFAULT NULL,
|
||||
`config_ticket_status_id_new` int(1) NOT NULL DEFAULT 1,
|
||||
`config_ticket_status_id_open` int(1) NOT NULL DEFAULT 2,
|
||||
`config_ticket_status_id_autoclose` int(1) NOT NULL DEFAULT 4,
|
||||
`config_ticket_status_id_closed` int(1) NOT NULL DEFAULT 5,
|
||||
`config_enable_cron` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`config_cron_key` varchar(255) DEFAULT NULL,
|
||||
`config_recurring_auto_send_invoice` tinyint(1) NOT NULL DEFAULT 1,
|
||||
|
|
@ -1560,6 +1564,19 @@ CREATE TABLE `ticket_replies` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `ticket_statuses`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `ticket_statuses`;
|
||||
CREATE TABLE IF NOT EXISTS `ticket_statuses` (
|
||||
`ticket_status_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ticket_status_name` varchar(200) NOT NULL,
|
||||
`ticket_status_color` varchar(200) NOT NULL,
|
||||
`ticket_status_active` TINYINT(1) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`ticket_status_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
--
|
||||
-- Table structure for table `ticket_views`
|
||||
--
|
||||
|
|
|
|||
|
|
@ -1139,6 +1139,22 @@ function createiCalStrCancel($originaliCalStr) {
|
|||
}
|
||||
|
||||
function getTicketStatusColor($ticket_status) {
|
||||
|
||||
global $mysqli;
|
||||
|
||||
if (intval($ticket_status)) {
|
||||
$status_id = intval($ticket_status);
|
||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM ticket_statuses WHERE ticket_status_id = $status_id LIMIT 1"));
|
||||
|
||||
if ($row) {
|
||||
return nullable_htmlentities($row['ticket_status_color']);
|
||||
}
|
||||
|
||||
// Default return
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
// Legacy support for named statuses
|
||||
if ($ticket_status == "New") {
|
||||
return "danger";
|
||||
} elseif ($ticket_status == "Open") {
|
||||
|
|
@ -1151,3 +1167,24 @@ function getTicketStatusColor($ticket_status) {
|
|||
return "dark";
|
||||
}
|
||||
}
|
||||
|
||||
function getTicketStatusName($ticket_status) {
|
||||
|
||||
global $mysqli;
|
||||
|
||||
// Legacy support for named statuses
|
||||
if (!intval($ticket_status)) {
|
||||
return $ticket_status;
|
||||
}
|
||||
|
||||
$status_id = intval($ticket_status);
|
||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM ticket_statuses WHERE ticket_status_id = $status_id LIMIT 1"));
|
||||
|
||||
if ($row) {
|
||||
return nullable_htmlentities($row['ticket_status_name']);
|
||||
}
|
||||
|
||||
// Default return
|
||||
return "Unknown";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,10 @@ $config_ticket_client_general_notifications = intval($row['config_ticket_client_
|
|||
$config_ticket_autoclose = intval($row['config_ticket_autoclose']);
|
||||
$config_ticket_autoclose_hours = intval($row['config_ticket_autoclose_hours']);
|
||||
$config_ticket_new_ticket_notification_email = $row['config_ticket_new_ticket_notification_email'];
|
||||
$config_ticket_status_id_new = intval($row['config_ticket_status_id_new']);
|
||||
$config_ticket_status_id_open = intval($row['config_ticket_status_id_open']);
|
||||
$config_ticket_status_id_autoclose = intval($row['config_ticket_status_id_autoclose']);
|
||||
$config_ticket_status_id_closed = intval($row['config_ticket_status_id_closed']);
|
||||
|
||||
// Cron
|
||||
$config_enable_cron = intval($row['config_enable_cron']);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ function verifyContactTicketAccess($requested_ticket_id, $expected_ticket_state)
|
|||
// Setup
|
||||
if ($expected_ticket_state == "Closed") {
|
||||
// Closed tickets
|
||||
$ticket_state_snippet = "ticket_status = 'Closed'";
|
||||
$ticket_state_snippet = "ticket_status = 'Closed' OR ticket_status = $config_ticket_status_id_closed";
|
||||
} else {
|
||||
// Open (working/hold) tickets
|
||||
$ticket_state_snippet = "ticket_status != 'Closed'";
|
||||
$ticket_state_snippet = "ticket_status != 'Closed' or ticket_status != $config_ticket_status_id_closed";
|
||||
}
|
||||
|
||||
// Verify the contact has access to the provided ticket ID
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ if (isset($_POST['add_ticket'])) {
|
|||
$new_config_ticket_next_number = $config_ticket_next_number + 1;
|
||||
mysqli_query($mysqli, "UPDATE settings SET config_ticket_next_number = $new_config_ticket_next_number WHERE company_id = 1");
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO tickets SET ticket_prefix = '$config_ticket_prefix', ticket_number = $ticket_number, ticket_subject = '$subject', ticket_details = '$details', ticket_priority = '$priority', ticket_status = 'New', ticket_created_by = 0, ticket_contact_id = $contact, ticket_client_id = $client_id");
|
||||
mysqli_query($mysqli, "INSERT INTO tickets SET ticket_prefix = '$config_ticket_prefix', ticket_number = $ticket_number, ticket_subject = '$subject', ticket_details = '$details', ticket_priority = '$priority', ticket_status = $config_ticket_status_id_new, ticket_created_by = 0, ticket_contact_id = $contact, ticket_client_id = $client_id");
|
||||
$id = mysqli_insert_id($mysqli);
|
||||
|
||||
// Notify agent DL of the new ticket, if populated with a valid email
|
||||
|
|
@ -86,7 +86,7 @@ if (isset($_POST['add_ticket_comment'])) {
|
|||
$ticket_reply_id = mysqli_insert_id($mysqli);
|
||||
|
||||
// Update Ticket Last Response Field & set ticket to open as client has replied
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_status = 'Open' WHERE ticket_id = $ticket_id AND ticket_client_id = $session_client_id LIMIT 1");
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_status = $config_ticket_status_id_open WHERE ticket_id = $ticket_id AND ticket_client_id = $session_client_id LIMIT 1");
|
||||
|
||||
|
||||
// Get ticket details & Notify the assigned tech (if any)
|
||||
|
|
@ -201,7 +201,7 @@ if (isset($_GET['close_ticket'])) {
|
|||
if (verifyContactTicketAccess($ticket_id, "Open")) {
|
||||
|
||||
// Close ticket
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_status = 'Closed', ticket_closed_at = NOW() WHERE ticket_id = $ticket_id AND ticket_client_id = $session_client_id");
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_status = $config_ticket_status_id_closed, ticket_closed_at = NOW() WHERE ticket_id = $ticket_id AND ticket_client_id = $session_client_id");
|
||||
|
||||
// Add reply
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = 'Ticket closed by $session_contact_name.', ticket_reply_type = 'Client', ticket_reply_by = $session_contact_id, ticket_reply_ticket_id = $ticket_id");
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ if (isset($_POST['add_ticket'])) {
|
|||
$client_id = intval($_POST['client']);
|
||||
$assigned_to = intval($_POST['assigned_to']);
|
||||
if ($assigned_to == 0) {
|
||||
$ticket_status = 'New';
|
||||
$ticket_status = $config_ticket_status_id_new;
|
||||
} else {
|
||||
$ticket_status = 'Open';
|
||||
$ticket_status = $config_ticket_status_id_open;
|
||||
}
|
||||
$contact = intval($_POST['contact']);
|
||||
$subject = sanitizeInput($_POST['subject']);
|
||||
|
|
@ -82,6 +82,7 @@ if (isset($_POST['add_ticket'])) {
|
|||
$ticket_details = mysqli_escape_string($mysqli, $row['ticket_details']);
|
||||
$ticket_priority = sanitizeInput($row['ticket_priority']);
|
||||
$ticket_status = sanitizeInput($row['ticket_status']);
|
||||
$ticket_status_name = sanitizeInput(getTicketStatusName($row['ticket_status']));
|
||||
$client_id = intval($row['ticket_client_id']);
|
||||
$ticket_created_by = intval($row['ticket_created_by']);
|
||||
$ticket_assigned_to = intval($row['ticket_assigned_to']);
|
||||
|
|
@ -330,8 +331,15 @@ if (isset($_POST['assign_ticket'])) {
|
|||
$ticket_id = intval($_POST['ticket_id']);
|
||||
$assigned_to = intval($_POST['assigned_to']);
|
||||
$ticket_status = sanitizeInput($_POST['ticket_status']);
|
||||
|
||||
// TODO: Remove this legacy if
|
||||
if ($ticket_status == 'New' && $assigned_to !== 0) {
|
||||
$ticket_status = 'Open';
|
||||
$ticket_status = $config_ticket_status_id_open;
|
||||
}
|
||||
|
||||
// New
|
||||
if ($ticket_status == $config_ticket_status_id_new && $assigned_to !== 0) {
|
||||
$ticket_status = $config_ticket_status_id_open;
|
||||
}
|
||||
|
||||
// Allow for un-assigning tickets
|
||||
|
|
@ -356,7 +364,7 @@ if (isset($_POST['assign_ticket'])) {
|
|||
}
|
||||
|
||||
// Get & verify ticket details
|
||||
$ticket_details_sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_subject, ticket_client_id, client_name FROM tickets LEFT JOIN clients ON ticket_client_id = client_id WHERE ticket_id = '$ticket_id' AND ticket_status != 'Closed'");
|
||||
$ticket_details_sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_subject, ticket_client_id, client_name FROM tickets LEFT JOIN clients ON ticket_client_id = client_id WHERE ticket_id = '$ticket_id' AND ticket_status != $config_ticket_status_id_closed AND ticket_status != 'Closed'");
|
||||
$ticket_details = mysqli_fetch_array($ticket_details_sql);
|
||||
|
||||
$ticket_prefix = sanitizeInput($ticket_details['ticket_prefix']);
|
||||
|
|
@ -434,7 +442,7 @@ if (isset($_GET['delete_ticket'])) {
|
|||
$ticket_status = sanitizeInput($row['ticket_status']);
|
||||
$client_id = intval($row['ticket_client_id']);
|
||||
|
||||
if ($ticket_status !== 'Closed') {
|
||||
if ($ticket_status !== $config_ticket_status_id_closed && $ticket_status !== 'Closed') {
|
||||
mysqli_query($mysqli, "DELETE FROM tickets WHERE ticket_id = $ticket_id");
|
||||
|
||||
// Delete all ticket replies
|
||||
|
|
@ -479,7 +487,7 @@ if (isset($_POST['bulk_assign_ticket'])) {
|
|||
$client_id = intval($row['ticket_client_id']);
|
||||
|
||||
if ($ticket_status == 'New' && $assigned_to !== 0) {
|
||||
$ticket_status = 'Open';
|
||||
$ticket_status = $config_ticket_status_id_open;
|
||||
}
|
||||
|
||||
// Allow for un-assigning tickets
|
||||
|
|
@ -621,7 +629,7 @@ if (isset($_POST['bulk_close_tickets'])) {
|
|||
|
||||
$ticket_prefix = sanitizeInput($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
$ticket_status = sanitizeInput($row['ticket_status']);
|
||||
$ticket_status = sanitizeInput(getTicketStatusName($row['ticket_status']));
|
||||
$ticket_subject = sanitizeInput($row['ticket_subject']);
|
||||
$current_ticket_priority = sanitizeInput($row['ticket_priority']);
|
||||
$client_id = intval($row['ticket_client_id']);
|
||||
|
|
@ -713,6 +721,7 @@ if (isset($_POST['bulk_ticket_reply'])) {
|
|||
// POST variables
|
||||
$ticket_reply = mysqli_escape_string($mysqli, $_POST['bulk_reply_details']);
|
||||
$ticket_status = sanitizeInput($_POST['bulk_status']);
|
||||
$ticket_status_name = sanitizeInput(getTicketStatusName($row['ticket_status']));
|
||||
$private_note = intval($_POST['bulk_private_reply']);
|
||||
if ($private_note == 1) {
|
||||
$ticket_reply_type = 'Internal';
|
||||
|
|
@ -780,7 +789,7 @@ if (isset($_POST['bulk_ticket_reply'])) {
|
|||
if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) {
|
||||
|
||||
$subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject";
|
||||
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been updated.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status<br>Portal: https://$base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$from_email<br>$company_phone";
|
||||
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been updated.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status_name<br>Portal: https://$base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$from_email<br>$company_phone";
|
||||
|
||||
$data = [];
|
||||
|
||||
|
|
@ -842,6 +851,7 @@ if (isset($_POST['add_ticket_reply'])) {
|
|||
$ticket_id = intval($_POST['ticket_id']);
|
||||
$ticket_reply = mysqli_real_escape_string($mysqli, $_POST['ticket_reply']);
|
||||
$ticket_status = sanitizeInput($_POST['status']);
|
||||
$ticket_status_name = sanitizeInput(getTicketStatusName($row['ticket_status']));
|
||||
// Handle the time inputs for hours, minutes, and seconds
|
||||
$hours = intval($_POST['hours']);
|
||||
$minutes = intval($_POST['minutes']);
|
||||
|
|
@ -869,7 +879,7 @@ if (isset($_POST['add_ticket_reply'])) {
|
|||
// Update Ticket Last Response Field
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_status = '$ticket_status' WHERE ticket_id = $ticket_id");
|
||||
|
||||
if ($ticket_status == 'Closed') {
|
||||
if ($ticket_status == $config_ticket_status_id_closed || $ticket_status == 'Closed') {
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_closed_at = NOW() WHERE ticket_id = $ticket_id");
|
||||
}
|
||||
|
||||
|
|
@ -909,15 +919,15 @@ if (isset($_POST['add_ticket_reply'])) {
|
|||
|
||||
// Slightly different email subject/text depending on if this update closed the ticket or not
|
||||
|
||||
if ($ticket_status == 'Closed') {
|
||||
if ($ticket_status == $config_ticket_status_id_closed || $ticket_status == 'Closed') {
|
||||
$subject = "Ticket closed - [$ticket_prefix$ticket_number] - $ticket_subject | (do not reply)";
|
||||
$body = "Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been closed.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>We hope the request/issue was resolved to your satisfaction. If you need further assistance, please raise a new ticket using the below details. Please do not reply to this email. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
} elseif ($ticket_status == 'Auto Close') {
|
||||
} elseif ($ticket_status == $config_ticket_status_id_autoclose || $ticket_status == 'Auto Close') {
|
||||
$subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject | (pending closure)";
|
||||
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been updated and is pending closure.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>If your request/issue is resolved, you can simply ignore this email. If you need further assistance, please respond to let us know! <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been updated and is pending closure.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>If your request/issue is resolved, you can simply ignore this email. If you need further assistance, please respond to let us know! <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status_name<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
} else {
|
||||
$subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject";
|
||||
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been updated.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been updated.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status_name<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ if (isset($_POST['add_company_settings'])) {
|
|||
unlink('uploads/tmp/cronkey.php');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Create Main Account Types
|
||||
mysqli_query($mysqli,"INSERT INTO account_types SET account_type_name = 'Asset', account_type_parent = 1, account_type_description = 'Assets are economic resources which are expected to benefit the business in the future.'");
|
||||
|
|
@ -295,6 +295,12 @@ if (isset($_POST['add_company_settings'])) {
|
|||
//Create Calendar
|
||||
mysqli_query($mysqli,"INSERT INTO calendars SET calendar_name = 'Default', calendar_color = 'blue'");
|
||||
|
||||
// Add default ticket statuses
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'New', ticket_status_color = 'danger'"); // Default ID for new tickets is 1
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Open', ticket_status_color = 'primary'"); // 2
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'On Hold', ticket_status_color = 'success'"); // 3
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Auto Close', ticket_status_color = 'success'"); // 4
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_statuses SET ticket_status_name = 'Closed', ticket_status_color = 'dark'"); // 5
|
||||
|
||||
|
||||
$_SESSION['alert_message'] = "Company <strong>$name</strong> created!";
|
||||
|
|
|
|||
22
tickets.php
22
tickets.php
|
|
@ -311,7 +311,7 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
$ticket_number = intval($row['ticket_number']);
|
||||
$ticket_subject = nullable_htmlentities($row['ticket_subject']);
|
||||
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||
$ticket_status = nullable_htmlentities($row['ticket_status']);
|
||||
$ticket_status = sanitizeInput(getTicketStatusName($row['ticket_status']));
|
||||
$ticket_billable = intval($row['ticket_billable']);
|
||||
$ticket_scheduled_for = nullable_htmlentities($row['ticket_schedule']);
|
||||
$ticket_created_at = nullable_htmlentities($row['ticket_created_at']);
|
||||
|
|
@ -319,7 +319,7 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
$ticket_updated_at = nullable_htmlentities($row['ticket_updated_at']);
|
||||
$ticket_updated_at_time_ago = timeAgo($row['ticket_updated_at']);
|
||||
if (empty($ticket_updated_at)) {
|
||||
if ($ticket_status == "Closed") {
|
||||
if ($ticket_status == $config_ticket_status_id_closed || $ticket_status == "Closed") {
|
||||
$ticket_updated_at_display = "<p>Never</p>";
|
||||
} else {
|
||||
$ticket_updated_at_display = "<p class='text-danger'>Never</p>";
|
||||
|
|
@ -333,17 +333,7 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||
|
||||
if ($ticket_status == "New") {
|
||||
$ticket_status_color = "danger";
|
||||
} elseif ($ticket_status == "Open") {
|
||||
$ticket_status_color = "primary";
|
||||
} elseif ($ticket_status == "On Hold") {
|
||||
$ticket_status_color = "success";
|
||||
} elseif ($ticket_status == "Auto Close") {
|
||||
$ticket_status_color = "dark";
|
||||
} elseif ($ticket_status == "Closed") {
|
||||
$ticket_status_color = "dark";
|
||||
}
|
||||
$ticket_status_color = getTicketStatusColor($ticket_status);
|
||||
|
||||
if ($ticket_priority == "High") {
|
||||
$ticket_priority_color = "danger";
|
||||
|
|
@ -355,7 +345,7 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
|
||||
$ticket_assigned_to = intval($row['ticket_assigned_to']);
|
||||
if (empty($ticket_assigned_to)) {
|
||||
if ($ticket_status == "Closed") {
|
||||
if ($ticket_status == $config_ticket_status_id_closed || $ticket_status == "Closed") {
|
||||
$ticket_assigned_to_display = "<p>Not Assigned</p>";
|
||||
} else {
|
||||
$ticket_assigned_to_display = "<p class='text-danger'>Not Assigned</p>";
|
||||
|
|
@ -398,7 +388,7 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
|
||||
<!-- Ticket Bulk Select -->
|
||||
<td>
|
||||
<?php if ($ticket_status !== "Closed") { ?>
|
||||
<?php if ($ticket_status == $config_ticket_status_id_closed || $ticket_status == "Closed") { ?>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input bulk-select" type="checkbox" name="ticket_ids[]" value="<?php echo $ticket_id ?>">
|
||||
</div>
|
||||
|
|
@ -470,7 +460,7 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
|
||||
<?php
|
||||
// Edit actions, for open tickets
|
||||
if ($ticket_status !== "Closed") {
|
||||
if ($ticket_status !== $config_ticket_status_id_closed || $ticket_status !== "Closed") {
|
||||
|
||||
require "ticket_assign_modal.php";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue