From 1e4306381f6e9730d3dae273b96b2ef8648d79e1 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 19 Nov 2024 18:46:07 -0500 Subject: [PATCH] DB Optimizing in Ticket Selections and relogicify mark billable also more logging --- post/user/ticket.php | 13 ++++--------- ticket_add_modal.php | 24 +++++++++++++----------- ticket_add_watcher_modal.php | 2 +- ticket_assign_modal.php | 3 ++- ticket_bulk_add_project_modal.php | 2 +- ticket_bulk_assign_modal.php | 1 + ticket_edit_contact_modal.php | 2 +- ticket_edit_modal.php | 13 ++++++------- 8 files changed, 29 insertions(+), 31 deletions(-) diff --git a/post/user/ticket.php b/post/user/ticket.php index 89c3b038..1e16c9b8 100644 --- a/post/user/ticket.php +++ b/post/user/ticket.php @@ -25,8 +25,9 @@ if (isset($_POST['add_ticket'])) { $asset_id = intval($_POST['asset']); $location_id = intval($_POST['location']); $project_id = intval($_POST['project']); - $use_primary_contact = intval($_POST['use_primary_contact']); + $use_primary_contact = intval($_POST['use_primary_contact'] ?? 0); $ticket_template_id = intval($_POST['ticket_template_id']); + $billable = intval($_POST['billable'] ?? 0); // Add the primary contact as the ticket contact if "Use primary contact" is checked if ($use_primary_contact == 1) { @@ -35,12 +36,6 @@ if (isset($_POST['add_ticket'])) { $contact = intval($row['contact_id']); } - if (!isset($_POST['billable'])) { - $billable = 1; - } else { - $billable = intval($_POST['billable']); - } - //Get the next Ticket Number and add 1 for the new ticket number $ticket_number = $config_ticket_next_number; $new_config_ticket_next_number = $config_ticket_next_number + 1; @@ -170,10 +165,10 @@ if (isset($_POST['edit_ticket'])) { $ticket_id = intval($_POST['ticket_id']); $contact_id = intval($_POST['contact']); - $notify = intval($_POST['contact_notify']); + $notify = intval($_POST['contact_notify'] ?? 0); $category_id = intval($_POST['category']); $ticket_subject = sanitizeInput($_POST['subject']); - $billable = intval($_POST['billable']); + $billable = intval($_POST['billable'] ?? 0); $ticket_priority = sanitizeInput($_POST['priority']); $details = mysqli_real_escape_string($mysqli, $_POST['details']); $vendor_ticket_number = sanitizeInput($_POST['vendor_ticket_number']); diff --git a/ticket_add_modal.php b/ticket_add_modal.php index 02016067..e38a0341 100644 --- a/ticket_add_modal.php +++ b/ticket_add_modal.php @@ -8,9 +8,7 @@
- - - +