From 6a3d53fc4b17c627526833e3a550987fe97c70b0 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 20 Mar 2024 12:53:25 -0400 Subject: [PATCH 01/21] Feature: Added Ticket Replies to Global Search --- client_contacts.php | 2 +- global_search.php | 79 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 75 insertions(+), 6 deletions(-) diff --git a/client_contacts.php b/client_contacts.php index 4ebe9c465..540c38ae8 100644 --- a/client_contacts.php +++ b/client_contacts.php @@ -10,7 +10,7 @@ //Rebuild URL $url_query_strings_sort = http_build_query($get_copy); -$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM contacts +$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM contacts LEFT JOIN locations ON location_id = contact_location_id WHERE contact_$archive_query AND (contact_name LIKE '%$q%' OR contact_title LIKE '%$q%' OR location_name LIKE '%$q%' OR contact_email LIKE '%$q%' OR contact_department LIKE '%$q%' OR contact_phone LIKE '%$phone_query%' OR contact_extension LIKE '%$q%' OR contact_mobile LIKE '%$phone_query%') diff --git a/global_search.php b/global_search.php index 418b8ca1c..a52b5c2cf 100644 --- a/global_search.php +++ b/global_search.php @@ -2,6 +2,12 @@ require_once "inc_all.php"; +// Initialize the HTML Purifier to prevent XSS +require "plugins/htmlpurifier/HTMLPurifier.standalone.php"; + +$purifier_config = HTMLPurifier_Config::createDefault(); +$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]); +$purifier = new HTMLPurifier($purifier_config); if (isset($_GET['query'])) { @@ -93,14 +99,26 @@ ORDER BY asset_name DESC LIMIT 5" ); + $sql_ticket_replies = mysqli_query($mysqli,"SELECT * FROM ticket_replies + LEFT JOIN tickets ON ticket_reply_ticket_id = ticket_id + LEFT JOIN clients ON ticket_client_id = client_id + WHERE ticket_reply_archived_at IS NULL + AND (ticket_reply LIKE '%$query%' OR ticket_subject LIKE '%$query%' OR ticket_details LIKE '%$query%') + ORDER BY ticket_id DESC LIMIT 5" + ); + $q = nullable_htmlentities($_GET['query']); ?> -

Search all things

-
+
+
+

Global Search

+
+
+ 0) { ?> @@ -617,11 +635,62 @@ -
+ 0) { ?> + + + +
+ +
+
+
Ticket Replies
+
+
+ + purify($row['ticket_reply']); + $client_id = intval($row['ticket_client_id']); + $client_name = nullable_htmlentities($row['client_name']); + + ?> +
+
+

+ - +

+
+ Open +
+
+
+
+
+ +
+
+
+
+ + +
- +
+ +
+ + + + Date: Wed, 20 Mar 2024 13:00:50 -0400 Subject: [PATCH 02/21] Include Client Name in Ticket Replies Global Search --- global_search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global_search.php b/global_search.php index a52b5c2cf..25b2f59b3 100644 --- a/global_search.php +++ b/global_search.php @@ -662,7 +662,7 @@

- - +

Open From 6790464e909422a7536b13180f0c10827d98ea5c Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 20 Mar 2024 13:05:10 -0400 Subject: [PATCH 03/21] Do not show DHCP if IP is null under assets --- client_assets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client_assets.php b/client_assets.php index cf0881f89..60dde070f 100644 --- a/client_assets.php +++ b/client_assets.php @@ -224,7 +224,7 @@ } $asset_ip = nullable_htmlentities($row['asset_ip']); if (empty($asset_ip)) { - $asset_ip_display = "DHCP"; + $asset_ip_display = "-"; } else { $asset_ip_display = $asset_ip; } From c0115a26c5fb87963bc1a8cec9afef584830f1ea Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 20 Mar 2024 13:36:04 -0400 Subject: [PATCH 04/21] Group Ticket Replies and only search in ticket reply not ticket subject or ticket details In global search --- global_search.php | 74 +++++++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/global_search.php b/global_search.php index 25b2f59b3..379f142c9 100644 --- a/global_search.php +++ b/global_search.php @@ -103,8 +103,8 @@ LEFT JOIN tickets ON ticket_reply_ticket_id = ticket_id LEFT JOIN clients ON ticket_client_id = client_id WHERE ticket_reply_archived_at IS NULL - AND (ticket_reply LIKE '%$query%' OR ticket_subject LIKE '%$query%' OR ticket_details LIKE '%$query%') - ORDER BY ticket_id DESC LIMIT 5" + AND (ticket_reply LIKE '%$query%') + ORDER BY ticket_id DESC, ticket_reply_id ASC LIMIT 20" ); $q = nullable_htmlentities($_GET['query']); @@ -648,36 +648,60 @@
'; + } + + $ticket_prefix = nullable_htmlentities($row['ticket_prefix']); + $ticket_number = intval($row['ticket_number']); + $ticket_subject = nullable_htmlentities($row['ticket_subject']); + $client_id = intval($row['ticket_client_id']); + $client_name = nullable_htmlentities($row['client_name']); + + // Output the ticket header + ?> +
+
+

+ +

+
+ Open +
+
+
+ purify($row['ticket_reply']); - $client_id = intval($row['ticket_client_id']); - $client_name = nullable_htmlentities($row['client_name']); + // Output the ticket reply ?> -
-
-

- -

-
- Open -
+
+ +
+
-
-
-
- -
-
-
-
- - +
+
+
'; + } + ?>
From 845e1689429918d26e46d582e9ae98a55a9bcee3 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 20 Mar 2024 14:22:57 -0400 Subject: [PATCH 05/21] Updated the rest of wording regarding email being sent to email been queued with a link to the Mail Queuer --- post/invoice.php | 10 +++++----- post/quote.php | 4 ++-- post/setting.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/post/invoice.php b/post/invoice.php index da872849d..965b3cffc 100644 --- a/post/invoice.php +++ b/post/invoice.php @@ -694,9 +694,9 @@ // Email Logging - $_SESSION['alert_message'] = "Email receipt sent "; + $_SESSION['alert_message'] = "Email queued successfully! Check Admin > Mail queue"; - mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Sent', history_description = 'Emailed Receipt!', history_invoice_id = $invoice_id"); + mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Sent', history_description = 'Email Receipt Queued', history_invoice_id = $invoice_id"); } @@ -726,7 +726,7 @@ // Email Logging - $_SESSION['alert_message'] .= "Email receipt sent "; + $_SESSION['alert_message'] = "Test email queued successfully! Check Admin > Mail queue"; mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Sent', history_description = 'Payment Receipt sent to mail queue ID: $email_id!', history_invoice_id = $invoice_id"); @@ -877,7 +877,7 @@ // Email Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Payment', log_action = 'Email', log_description = 'Bulk Payment receipt for multiple Invoices queued to $contact_email Email ID: $email_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $payment_id"); - $_SESSION['alert_message'] .= "Email receipt sent and "; + $_SESSION['alert_message'] .= "Email receipt queued and "; } // End Email @@ -1013,7 +1013,7 @@ // Get Email ID for reference $email_id = mysqli_insert_id($mysqli); - $_SESSION['alert_message'] = "Invoice has been sent"; + $_SESSION['alert_message'] = "Invoice sent to mail queue! Check Admin > Mail queue"; mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Sent', history_description = 'Invoice sent to the mail queue ID: $email_id', history_invoice_id = $invoice_id"); // Don't change the status to sent if the status is anything but draft diff --git a/post/quote.php b/post/quote.php index 69c2075a0..c0a4fa92b 100644 --- a/post/quote.php +++ b/post/quote.php @@ -407,10 +407,10 @@ addToMailQueue($mysqli, $data); // Logging - mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Sent', history_description = 'Emailed Quote!', history_quote_id = $quote_id"); + mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Sent', history_description = 'Email Quote Queued', history_quote_id = $quote_id"); mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Quote', log_action = 'Email', log_description = '$session_name emailed Quote $quote_prefix$quote_number to $contact_email Email ID: ', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $quote_id"); - $_SESSION['alert_message'] = "Quote has been sent"; + $_SESSION['alert_message'] = "Quote has been queued successfully! Check Admin > Mail queue"; //Don't change the status to sent if the status is anything but draft if ($quote_status == 'Draft') { diff --git a/post/setting.php b/post/setting.php index fa99eed19..303c74909 100644 --- a/post/setting.php +++ b/post/setting.php @@ -184,7 +184,7 @@ $mail = addToMailQueue($mysqli, $data); if ($mail === true) { - $_SESSION['alert_message'] = "Test email queued successfully - Check Admin > Mail queue"; + $_SESSION['alert_message'] = "Test email queued successfully! Check Admin > Mail queue"; } else { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Failed to add test mail to queue"; From 534096f182683c46922c22c69ab879ed913832d7 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 20 Mar 2024 16:54:38 -0400 Subject: [PATCH 06/21] Software Licenese / Template Enhancements: Fixed create Software from template, added description, user media css for licenses and templates, reworked the add edit modal, Removed Software Login --- admin_software_template_add_modal.php | 14 +++++- admin_software_template_edit_modal.php | 14 +++++- admin_software_templates.php | 31 ++++++++----- client_software.php | 64 ++++++-------------------- client_software_add_modal.php | 42 +++++------------ client_software_edit_modal.php | 52 ++++++++------------- post/software.php | 56 +++++++--------------- 7 files changed, 105 insertions(+), 168 deletions(-) diff --git a/admin_software_template_add_modal.php b/admin_software_template_add_modal.php index 823c1c89c..2454dfb17 100644 --- a/admin_software_template_add_modal.php +++ b/admin_software_template_add_modal.php @@ -2,7 +2,7 @@