diff --git a/ajax.php b/ajax.php index ddf5639a0..8875fb597 100644 --- a/ajax.php +++ b/ajax.php @@ -351,9 +351,9 @@ } /* - * Looks up info for a given scheduled ticket ID from the database, used to dynamically populate modal edit fields + * Looks up info for a given recurring (was scheduled) ticket ID from the database, used to dynamically populate modal edit fields */ -if (isset($_GET['scheduled_ticket_get_json_details'])) { +if (isset($_GET['recurring_ticket_get_json_details'])) { validateTechRole(); $client_id = intval($_GET['client_id']); diff --git a/client_recurring_tickets.php b/client_recurring_tickets.php index 128322a9a..3fe0275cf 100644 --- a/client_recurring_tickets.php +++ b/client_recurring_tickets.php @@ -89,7 +89,7 @@ - + @@ -104,13 +104,13 @@ diff --git a/cron.php b/cron.php index 3cdbf338c..4629afa92 100644 --- a/cron.php +++ b/cron.php @@ -232,9 +232,9 @@ mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for tickets that are pending assignment'"); } -// Scheduled tickets +// Recurring (Scheduled) tickets -// Get scheduled tickets for today +// Get recurring tickets for today $sql_scheduled_tickets = mysqli_query($mysqli, "SELECT * FROM scheduled_tickets WHERE scheduled_ticket_next_run = CURDATE()"); if (mysqli_num_rows($sql_scheduled_tickets) > 0) { @@ -263,11 +263,10 @@ $id = mysqli_insert_id($mysqli); // Logging - mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Ticket', log_action = 'Create', log_description = 'System created scheduled $frequency ticket - $subject', log_client_id = $client_id, log_user_id = $created_id"); + mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Ticket', log_action = 'Create', log_description = 'System created recurring scheduled $frequency ticket - $subject', log_client_id = $client_id, log_user_id = $created_id"); // Notifications - // Get client/contact/ticket details $sql = mysqli_query( $mysqli, @@ -313,8 +312,8 @@ // Notify agent's via the DL address of the new ticket, if it's populated with a valid email if (filter_var($config_ticket_new_ticket_notification_email, FILTER_VALIDATE_EMAIL)) { - $email_subject = "ITFlow - New Scheduled Ticket - $client_name: $ticket_subject"; - $email_body = "Hello,

This is a notification that a new scheduled ticket has been raised in ITFlow.
Ticket: $ticket_prefix$ticket_number
Client: $client_name
Priority: $priority
Link: https://$config_base_url/ticket.php?ticket_id=$id

--------------------------------

$ticket_subject
$ticket_details"; + $email_subject = "ITFlow - New Recurring Ticket - $client_name: $ticket_subject"; + $email_body = "Hello,

This is a notification that a recurring scheduled ticket has been raised in ITFlow.
Ticket: $ticket_prefix$ticket_number
Client: $client_name
Priority: $priority
Link: https://$config_base_url/ticket.php?ticket_id=$id

--------------------------------

$ticket_subject
$ticket_details"; $email = [ 'from' => $config_ticket_from_email, @@ -358,7 +357,7 @@ } // Logging -//mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created sent out scheduled tickets'"); +//mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created sent out recurring tickets'"); // AUTO CLOSE TICKET - CLOSE @@ -729,7 +728,7 @@ $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('recurring_id') AS num FROM tickets")); $ticket_count = $row['num']; - // Scheduled Ticket Count + // Recurring (Scheduled) Ticket Count $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('scheduled_ticket_id') AS num FROM scheduled_tickets")); $scheduled_ticket_count = $row['num']; diff --git a/js/recurring_tickets_edit_modal.js b/js/recurring_tickets_edit_modal.js index 67525ad6c..07de7c6b9 100644 --- a/js/recurring_tickets_edit_modal.js +++ b/js/recurring_tickets_edit_modal.js @@ -1,9 +1,9 @@ -function populateScheduledTicketEditModal(client_id, ticket_id) { +function populateRecurringTicketEditModal(client_id, ticket_id) { - // Send a GET request to ajax.php as ajax.php?scheduled_ticket_get_json_details=true&client_id=NUM&ticket_id=NUM + // Send a GET request to ajax.php as ajax.php?recurring_ticket_get_json_details=true&client_id=NUM&ticket_id=NUM jQuery.get( "ajax.php", - {scheduled_ticket_get_json_details: 'true', client_id: client_id, ticket_id: ticket_id}, + {recurring_ticket_get_json_details: 'true', client_id: client_id, ticket_id: ticket_id}, function(data){ // If we get a response from post.php, parse it as JSON diff --git a/post/scheduled_ticket_model.php b/post/recurring_ticket_model.php similarity index 100% rename from post/scheduled_ticket_model.php rename to post/recurring_ticket_model.php diff --git a/post/ticket.php b/post/ticket.php index 19770fea6..260004b34 100644 --- a/post/ticket.php +++ b/post/ticket.php @@ -1319,11 +1319,11 @@ exit; } -if (isset($_POST['add_scheduled_ticket'])) { +if (isset($_POST['add_scheduled_ticket']) || isset($_POST['add_recurring_ticket'])) { validateTechRole(); - require_once 'post/scheduled_ticket_model.php'; + require_once 'post/recurring_ticket_model.php'; $start_date = sanitizeInput($_POST['start_date']); @@ -1340,18 +1340,18 @@ $scheduled_ticket_id = mysqli_insert_id($mysqli); // Logging - mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Scheduled Ticket', log_action = 'Create', log_description = '$session_name created scheduled ticket for $subject - $frequency', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $scheduled_ticket_id"); + mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Recurring Ticket', log_action = 'Create', log_description = '$session_name created recurring ticket for $subject - $frequency', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $scheduled_ticket_id"); - $_SESSION['alert_message'] = "Scheduled ticket $subject - $frequency created"; + $_SESSION['alert_message'] = "Recurring ticket $subject - $frequency created"; header("Location: " . $_SERVER["HTTP_REFERER"]); } -if (isset($_POST['edit_scheduled_ticket'])) { +if (isset($_POST['edit_scheduled_ticket']) || isset($_POST['edit_recurring_ticket'])) { validateTechRole(); - require_once 'post/scheduled_ticket_model.php'; + require_once 'post/recurring_ticket_model.php'; $scheduled_ticket_id = intval($_POST['scheduled_ticket_id']); $next_run_date = sanitizeInput($_POST['next_date']); @@ -1367,14 +1367,14 @@ mysqli_query($mysqli, "UPDATE scheduled_tickets SET scheduled_ticket_subject = '$subject', scheduled_ticket_details = '$details', scheduled_ticket_priority = '$priority', scheduled_ticket_frequency = '$frequency', scheduled_ticket_next_run = '$next_run_date', scheduled_ticket_asset_id = $asset_id, scheduled_ticket_contact_id = $contact_id WHERE scheduled_ticket_id = $scheduled_ticket_id"); // Logging - mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Scheduled Ticket', log_action = 'Modify', log_description = '$session_name modified scheduled ticket for $subject - $frequency', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $scheduled_ticket_id"); + mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Recurring Ticket', log_action = 'Modify', log_description = '$session_name modified recurring ticket for $subject - $frequency', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $scheduled_ticket_id"); - $_SESSION['alert_message'] = "Scheduled ticket $subject - $frequency updated"; + $_SESSION['alert_message'] = "Recurring ticket $subject - $frequency updated"; header("Location: " . $_SERVER["HTTP_REFERER"]); } -if (isset($_GET['delete_scheduled_ticket'])) { +if (isset($_GET['delete_scheduled_ticket']) || isset($_POST['delete_recurring_ticket'])) { validateAdminRole(); @@ -1399,29 +1399,29 @@ header("Location: " . $_SERVER["HTTP_REFERER"]); } -if (isset($_POST['bulk_delete_scheduled_tickets'])) { +if (isset($_POST['bulk_delete_scheduled_tickets']) || isset($_POST['bulk_delete_recurring_tickets'])) { validateAdminRole(); validateCSRFToken($_POST['csrf_token']); $count = 0; // Default 0 - $scheduled_ticket_ids = $_POST['scheduled_ticket_ids']; // Get array of scheduled tickets IDs to be deleted + $scheduled_ticket_ids = $_POST['scheduled_ticket_ids']; // Get array of recurring scheduled tickets IDs to be deleted if (!empty($scheduled_ticket_ids)) { - // Cycle through array and delete each scheduled ticket + // Cycle through array and delete each recurring scheduled ticket foreach ($scheduled_ticket_ids as $scheduled_ticket_id) { $scheduled_ticket_id = intval($scheduled_ticket_id); mysqli_query($mysqli, "DELETE FROM scheduled_tickets WHERE scheduled_ticket_id = $scheduled_ticket_id"); - mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Scheduled Ticket', log_action = 'Delete', log_description = '$session_name deleted scheduled ticket (bulk)', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, log_entity_id = $scheduled_ticket_id"); + mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Scheduled Ticket', log_action = 'Delete', log_description = '$session_name deleted recurring ticket (bulk)', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, log_entity_id = $scheduled_ticket_id"); $count++; } // Logging - mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Scheduled Ticket', log_action = 'Delete', log_description = '$session_name bulk deleted $count scheduled tickets', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); + mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Scheduled Ticket', log_action = 'Delete', log_description = '$session_name bulk deleted $count recurring tickets', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); - $_SESSION['alert_message'] = "Deleted $count scheduled ticket(s)"; + $_SESSION['alert_message'] = "Deleted $count recurring ticket(s)"; } header("Location: " . $_SERVER["HTTP_REFERER"]); @@ -1461,7 +1461,6 @@ if (isset($_POST['edit_ticket_schedule'])) { - validateTechRole(); $ticket_id = intval($_POST['ticket_id']); diff --git a/recurring_ticket_add_modal.php b/recurring_ticket_add_modal.php index d723db651..adb787705 100644 --- a/recurring_ticket_add_modal.php +++ b/recurring_ticket_add_modal.php @@ -157,10 +157,10 @@ - \ No newline at end of file + diff --git a/recurring_ticket_edit_modal.php b/recurring_ticket_edit_modal.php index 6081be31f..d7a9717ef 100644 --- a/recurring_ticket_edit_modal.php +++ b/recurring_ticket_edit_modal.php @@ -94,10 +94,10 @@ - \ No newline at end of file + diff --git a/recurring_tickets.php b/recurring_tickets.php index f89a907c6..f0204ad4d 100644 --- a/recurring_tickets.php +++ b/recurring_tickets.php @@ -57,7 +57,7 @@ Bulk Action (0) @@ -117,7 +117,7 @@ - )"> + )"> @@ -133,13 +133,13 @@