From 309ad724ecfb7496baa48d3973d52fe70decefb9 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 29 Mar 2025 16:22:48 -0400 Subject: [PATCH 01/35] Fix client export to only show licnesed software by the selected client only --- post/user/client.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/post/user/client.php b/post/user/client.php index 4ab99da6..63f9dc63 100644 --- a/post/user/client.php +++ b/post/user/client.php @@ -716,6 +716,8 @@ if (isset($_POST["export_client_pdf"])) { software ON software_contacts.software_id = software.software_id WHERE software_archived_at IS NULL AND contact_archived_at IS NULL + AND software_client_id = $client_id + AND contact_client_id = $client_id ORDER BY contact_name, software_name;" ); @@ -732,6 +734,8 @@ if (isset($_POST["export_client_pdf"])) { software ON software_assets.software_id = software.software_id WHERE software_archived_at IS NULL AND asset_archived_at IS NULL + AND software_client_id = $client_id + AND asset_client_id = $client_id ORDER BY asset_name, software_name;" ); From 762ec51a1935411daae363477d0b69b3fced517d Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 29 Mar 2025 16:41:40 -0400 Subject: [PATCH 02/35] Fix issue with missing phone numbers --- ajax/ajax_contact_details.php | 2 +- ajax/ajax_contact_edit.php | 2 +- contact_details.php | 2 +- post/user/client.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ajax/ajax_contact_details.php b/ajax/ajax_contact_details.php index 4edce4a8..bd91b576 100644 --- a/ajax/ajax_contact_details.php +++ b/ajax/ajax_contact_details.php @@ -22,7 +22,7 @@ $contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_ $contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code)); $contact_extension = nullable_htmlentities($row['contact_extension']); $contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']); -$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_mobile_country_code)); +$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code)); $contact_email = nullable_htmlentities($row['contact_email']); $contact_photo = nullable_htmlentities($row['contact_photo']); $contact_pin = nullable_htmlentities($row['contact_pin']); diff --git a/ajax/ajax_contact_edit.php b/ajax/ajax_contact_edit.php index 9e650361..339ed3ee 100644 --- a/ajax/ajax_contact_edit.php +++ b/ajax/ajax_contact_edit.php @@ -19,7 +19,7 @@ $contact_extension = nullable_htmlentities($row['contact_extension']); $contact_phone_country_code = nullable_htmlentities($row['contact_phone_country_code']); $contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code)); $contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']); -$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_mobile_country_code)); +$contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code)); $contact_email = nullable_htmlentities($row['contact_email']); $contact_pin = nullable_htmlentities($row['contact_pin']); $contact_photo = nullable_htmlentities($row['contact_photo']); diff --git a/contact_details.php b/contact_details.php index f77f7051..f77ff726 100644 --- a/contact_details.php +++ b/contact_details.php @@ -32,7 +32,7 @@ if (isset($_GET['contact_id'])) { $contact_phone = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code)); $contact_extension = nullable_htmlentities($row['contact_extension']); $contact_mobile_country_code = nullable_htmlentities($row['contact_mobile_country_code']); - $contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_phone'], $contact_mobile_country_code)); + $contact_mobile = nullable_htmlentities(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code)); $contact_email = nullable_htmlentities($row['contact_email']); $contact_photo = nullable_htmlentities($row['contact_photo']); $contact_pin = nullable_htmlentities($row['contact_pin']); diff --git a/post/user/client.php b/post/user/client.php index 63f9dc63..bd95eb32 100644 --- a/post/user/client.php +++ b/post/user/client.php @@ -641,7 +641,7 @@ if (isset($_POST["export_client_pdf"])) { $contact_phone = nullable_htmlentities(formatPhoneNumber($row["contact_phone"], $contact_phone_country_code)); $contact_extension = nullable_htmlentities($row["contact_extension"]); $contact_mobile_country_code = nullable_htmlentities($row["contact_mobile_country_code"]); - $contact_mobile = nullable_htmlentities(formatPhoneNumber($row["contact_phone"], $contact_mobile_country_code)); + $contact_mobile = nullable_htmlentities(formatPhoneNumber($row["contact_mobile"], $contact_mobile_country_code)); $contact_email = nullable_htmlentities($row["contact_email"]); $client_website = nullable_htmlentities($row["client_website"]); @@ -829,7 +829,7 @@ if (isset($_POST["export_client_pdf"])) { $contact_extension = "x$contact_extension"; } $contact_mobile_country_code = nullable_htmlentities($row["contact_mobile_country_code"]); - $contact_mobile = nullable_htmlentities(formatPhoneNumber($row["contact_phone"], $contact_mobile_country_code)); + $contact_mobile = nullable_htmlentities(formatPhoneNumber($row["contact_mobile"], $contact_mobile_country_code)); $html .= " $contact_name From d5665c2577704db9cfe51aae076da060857aea0d Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 29 Mar 2025 17:35:53 -0400 Subject: [PATCH 03/35] Update db.sql to match the mediumtext of the updates --- db.sql | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/db.sql b/db.sql index e7e25b7d..724d1fb6 100644 --- a/db.sql +++ b/db.sql @@ -201,7 +201,7 @@ CREATE TABLE `asset_interfaces` ( `interface_ip` varchar(200) DEFAULT NULL, `interface_nat_ip` varchar(200) DEFAULT NULL, `interface_ipv6` varchar(200) DEFAULT NULL, - `interface_notes` text DEFAULT NULL, + `interface_notes` mediumtext DEFAULT NULL, `interface_primary` tinyint(1) DEFAULT 0, `interface_created_at` datetime NOT NULL DEFAULT current_timestamp(), `interface_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), @@ -224,7 +224,7 @@ DROP TABLE IF EXISTS `asset_notes`; CREATE TABLE `asset_notes` ( `asset_note_id` int(11) NOT NULL AUTO_INCREMENT, `asset_note_type` varchar(200) NOT NULL, - `asset_note` text DEFAULT NULL, + `asset_note` mediumtext DEFAULT NULL, `asset_note_created_by` int(11) NOT NULL, `asset_note_created_at` datetime NOT NULL DEFAULT current_timestamp(), `asset_note_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), @@ -459,7 +459,7 @@ DROP TABLE IF EXISTS `client_notes`; CREATE TABLE `client_notes` ( `client_note_id` int(11) NOT NULL AUTO_INCREMENT, `client_note_type` varchar(200) NOT NULL, - `client_note` text DEFAULT NULL, + `client_note` mediumtext DEFAULT NULL, `client_note_created_by` int(11) NOT NULL, `client_note_created_at` datetime NOT NULL DEFAULT current_timestamp(), `client_note_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), @@ -639,7 +639,7 @@ DROP TABLE IF EXISTS `contact_notes`; CREATE TABLE `contact_notes` ( `contact_note_id` int(11) NOT NULL AUTO_INCREMENT, `contact_note_type` varchar(200) NOT NULL, - `contact_note` text DEFAULT NULL, + `contact_note` mediumtext DEFAULT NULL, `contact_note_created_by` int(11) NOT NULL, `contact_note_created_at` datetime NOT NULL DEFAULT current_timestamp(), `contact_note_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), @@ -782,7 +782,7 @@ DROP TABLE IF EXISTS `custom_links`; CREATE TABLE `custom_links` ( `custom_link_id` int(11) NOT NULL AUTO_INCREMENT, `custom_link_name` varchar(200) NOT NULL, - `custom_link_description` text DEFAULT NULL, + `custom_link_description` mediumtext DEFAULT NULL, `custom_link_uri` varchar(500) NOT NULL, `custom_link_new_tab` tinyint(1) NOT NULL DEFAULT 0, `custom_link_icon` varchar(200) DEFAULT NULL, @@ -1292,7 +1292,7 @@ DROP TABLE IF EXISTS `project_templates`; CREATE TABLE `project_templates` ( `project_template_id` int(11) NOT NULL AUTO_INCREMENT, `project_template_name` varchar(200) NOT NULL, - `project_template_description` text DEFAULT NULL, + `project_template_description` mediumtext DEFAULT NULL, `project_template_created_at` datetime NOT NULL DEFAULT current_timestamp(), `project_template_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), `project_template_archived_at` datetime DEFAULT NULL, @@ -1403,14 +1403,14 @@ DROP TABLE IF EXISTS `racks`; CREATE TABLE `racks` ( `rack_id` int(11) NOT NULL AUTO_INCREMENT, `rack_name` varchar(200) NOT NULL, - `rack_description` text DEFAULT NULL, + `rack_description` mediumtext DEFAULT NULL, `rack_model` varchar(200) DEFAULT NULL, `rack_depth` varchar(50) DEFAULT NULL, `rack_type` varchar(50) DEFAULT NULL, `rack_units` int(11) NOT NULL, `rack_photo` varchar(200) DEFAULT NULL, `rack_physical_location` varchar(200) DEFAULT NULL, - `rack_notes` text DEFAULT NULL, + `rack_notes` mediumtext DEFAULT NULL, `rack_created_at` datetime NOT NULL DEFAULT current_timestamp(), `rack_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), `rack_archived_at` datetime DEFAULT NULL, @@ -2175,7 +2175,7 @@ DROP TABLE IF EXISTS `ticket_templates`; CREATE TABLE `ticket_templates` ( `ticket_template_id` int(11) NOT NULL AUTO_INCREMENT, `ticket_template_name` varchar(200) NOT NULL, - `ticket_template_description` text DEFAULT NULL, + `ticket_template_description` mediumtext DEFAULT NULL, `ticket_template_subject` varchar(500) DEFAULT NULL, `ticket_template_details` longtext DEFAULT NULL, `ticket_template_created_at` datetime NOT NULL DEFAULT current_timestamp(), @@ -2498,4 +2498,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-03-26 11:13:46 +-- Dump completed on 2025-03-29 17:35:17 From 1e98ee891691861cac16025405d947e926db4a3b Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 29 Mar 2025 17:43:00 -0400 Subject: [PATCH 04/35] Update app version and Changelog hotfix --- CHANGELOG.md | 7 +++++++ includes/app_version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b802af8a..3e0e60ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ This file documents all notable changes made to ITFlow. +## [25.03.1] + +### Fixed +- Phone number missing in various sections. +- Match Database. +- Client Export Only display licenses users and assets from the selected client only. + ## [25.03] ### Fixed diff --git a/includes/app_version.php b/includes/app_version.php index 956cbfa0..c0e7e2c3 100644 --- a/includes/app_version.php +++ b/includes/app_version.php @@ -5,4 +5,4 @@ * Update this file each time we merge develop into master. Format is YY.MM (add a .v if there is more than one release a month. */ -DEFINE("APP_VERSION", "25.03"); +DEFINE("APP_VERSION", "25.03.1"); From c4df5bf9885ef93ba7e53da303d9ffa8286adbe7 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 29 Mar 2025 18:12:32 -0400 Subject: [PATCH 05/35] DB.sql revert --- db.sql | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/db.sql b/db.sql index 724d1fb6..6c42bc1d 100644 --- a/db.sql +++ b/db.sql @@ -201,7 +201,7 @@ CREATE TABLE `asset_interfaces` ( `interface_ip` varchar(200) DEFAULT NULL, `interface_nat_ip` varchar(200) DEFAULT NULL, `interface_ipv6` varchar(200) DEFAULT NULL, - `interface_notes` mediumtext DEFAULT NULL, + `interface_notes` text DEFAULT NULL, `interface_primary` tinyint(1) DEFAULT 0, `interface_created_at` datetime NOT NULL DEFAULT current_timestamp(), `interface_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), @@ -224,7 +224,7 @@ DROP TABLE IF EXISTS `asset_notes`; CREATE TABLE `asset_notes` ( `asset_note_id` int(11) NOT NULL AUTO_INCREMENT, `asset_note_type` varchar(200) NOT NULL, - `asset_note` mediumtext DEFAULT NULL, + `asset_note` text DEFAULT NULL, `asset_note_created_by` int(11) NOT NULL, `asset_note_created_at` datetime NOT NULL DEFAULT current_timestamp(), `asset_note_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), @@ -459,7 +459,7 @@ DROP TABLE IF EXISTS `client_notes`; CREATE TABLE `client_notes` ( `client_note_id` int(11) NOT NULL AUTO_INCREMENT, `client_note_type` varchar(200) NOT NULL, - `client_note` mediumtext DEFAULT NULL, + `client_note` text DEFAULT NULL, `client_note_created_by` int(11) NOT NULL, `client_note_created_at` datetime NOT NULL DEFAULT current_timestamp(), `client_note_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), @@ -782,7 +782,7 @@ DROP TABLE IF EXISTS `custom_links`; CREATE TABLE `custom_links` ( `custom_link_id` int(11) NOT NULL AUTO_INCREMENT, `custom_link_name` varchar(200) NOT NULL, - `custom_link_description` mediumtext DEFAULT NULL, + `custom_link_description` text DEFAULT NULL, `custom_link_uri` varchar(500) NOT NULL, `custom_link_new_tab` tinyint(1) NOT NULL DEFAULT 0, `custom_link_icon` varchar(200) DEFAULT NULL, @@ -1292,7 +1292,7 @@ DROP TABLE IF EXISTS `project_templates`; CREATE TABLE `project_templates` ( `project_template_id` int(11) NOT NULL AUTO_INCREMENT, `project_template_name` varchar(200) NOT NULL, - `project_template_description` mediumtext DEFAULT NULL, + `project_template_description` text DEFAULT NULL, `project_template_created_at` datetime NOT NULL DEFAULT current_timestamp(), `project_template_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), `project_template_archived_at` datetime DEFAULT NULL, @@ -1403,14 +1403,14 @@ DROP TABLE IF EXISTS `racks`; CREATE TABLE `racks` ( `rack_id` int(11) NOT NULL AUTO_INCREMENT, `rack_name` varchar(200) NOT NULL, - `rack_description` mediumtext DEFAULT NULL, + `rack_description` text DEFAULT NULL, `rack_model` varchar(200) DEFAULT NULL, `rack_depth` varchar(50) DEFAULT NULL, `rack_type` varchar(50) DEFAULT NULL, `rack_units` int(11) NOT NULL, `rack_photo` varchar(200) DEFAULT NULL, `rack_physical_location` varchar(200) DEFAULT NULL, - `rack_notes` mediumtext DEFAULT NULL, + `rack_notes` text DEFAULT NULL, `rack_created_at` datetime NOT NULL DEFAULT current_timestamp(), `rack_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), `rack_archived_at` datetime DEFAULT NULL, @@ -2175,7 +2175,7 @@ DROP TABLE IF EXISTS `ticket_templates`; CREATE TABLE `ticket_templates` ( `ticket_template_id` int(11) NOT NULL AUTO_INCREMENT, `ticket_template_name` varchar(200) NOT NULL, - `ticket_template_description` mediumtext DEFAULT NULL, + `ticket_template_description` text DEFAULT NULL, `ticket_template_subject` varchar(500) DEFAULT NULL, `ticket_template_details` longtext DEFAULT NULL, `ticket_template_created_at` datetime NOT NULL DEFAULT current_timestamp(), @@ -2498,4 +2498,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-03-29 17:35:17 +-- Dump completed on 2025-03-29 18:12:19 From 127afdca0df50b1f10ef5afecb00c3e4a8df26b1 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 29 Mar 2025 18:16:25 -0400 Subject: [PATCH 06/35] DB.sql revert 2 --- db.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db.sql b/db.sql index 6c42bc1d..4a4f9959 100644 --- a/db.sql +++ b/db.sql @@ -639,7 +639,7 @@ DROP TABLE IF EXISTS `contact_notes`; CREATE TABLE `contact_notes` ( `contact_note_id` int(11) NOT NULL AUTO_INCREMENT, `contact_note_type` varchar(200) NOT NULL, - `contact_note` mediumtext DEFAULT NULL, + `contact_note` text DEFAULT NULL, `contact_note_created_by` int(11) NOT NULL, `contact_note_created_at` datetime NOT NULL DEFAULT current_timestamp(), `contact_note_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), @@ -2498,4 +2498,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-03-29 18:12:19 +-- Dump completed on 2025-03-29 18:16:21 From 531f3ec741cfb5e7dcbd81280f2e5509e07cc661 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 29 Mar 2025 18:18:52 -0400 Subject: [PATCH 07/35] Update app version and changelog --- CHANGELOG.md | 4 ++++ includes/app_version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e0e60ce..9d6d2a7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog This file documents all notable changes made to ITFlow. +## [25.03.2] + +### Fixed +- Revert DB.sql change ## [25.03.1] diff --git a/includes/app_version.php b/includes/app_version.php index c0e7e2c3..9496998d 100644 --- a/includes/app_version.php +++ b/includes/app_version.php @@ -5,4 +5,4 @@ * Update this file each time we merge develop into master. Format is YY.MM (add a .v if there is more than one release a month. */ -DEFINE("APP_VERSION", "25.03.1"); +DEFINE("APP_VERSION", "25.03.2"); From a2599e5d430f2a4ca6ec7269f05b099804ea105a Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sun, 30 Mar 2025 02:14:06 -0400 Subject: [PATCH 08/35] Fix network location edit --- ajax/ajax_network_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ajax/ajax_network_edit.php b/ajax/ajax_network_edit.php index fb53f4b0..71b6139d 100644 --- a/ajax/ajax_network_edit.php +++ b/ajax/ajax_network_edit.php @@ -90,7 +90,7 @@ ob_start(); $location_id = intval($row['location_id']); $location_name = nullable_htmlentities($row['location_name']); ?> - Date: Sun, 30 Mar 2025 11:45:27 -0400 Subject: [PATCH 09/35] Fix setting country code in company details --- post/admin/admin_settings_company.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/post/admin/admin_settings_company.php b/post/admin/admin_settings_company.php index 5f11db43..3df3c4a1 100644 --- a/post/admin/admin_settings_company.php +++ b/post/admin/admin_settings_company.php @@ -12,6 +12,7 @@ if (isset($_POST['edit_company'])) { $state = sanitizeInput($_POST['state']); $zip = sanitizeInput($_POST['zip']); $country = sanitizeInput($_POST['country']); + $phone_country_code = preg_replace("/[^0-9]/", '',$_POST['phone_country_code']); $phone = preg_replace("/[^0-9]/", '',$_POST['phone']); $email = sanitizeInput($_POST['email']); $website = sanitizeInput($_POST['website']); @@ -40,7 +41,7 @@ if (isset($_POST['edit_company'])) { } } - mysqli_query($mysqli,"UPDATE companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone = '$phone', company_email = '$email', company_website = '$website' WHERE company_id = 1"); + mysqli_query($mysqli,"UPDATE companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone_country_code = '$phone_country_code', company_phone = '$phone', company_email = '$email', company_website = '$website' WHERE company_id = 1"); // Logging logAction("Settings", "Edit", "$session_name edited company details"); From 42606067c093daa556282504ae63151983d95b00 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sun, 30 Mar 2025 12:22:43 -0400 Subject: [PATCH 10/35] If no country code is entered display the number only no spaces hyphens or perenthesis --- functions.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/functions.php b/functions.php index 3176c6ba..f2d0ca37 100644 --- a/functions.php +++ b/functions.php @@ -320,12 +320,7 @@ function formatPhoneNumber($phoneNumber, $country_code = '', $show_country_code break; } - // Fallback if formatting failed - if (!$formatted && strlen($digits) >= 7) { - $formatted = substr($digits, 0, 3) . ' ' . substr($digits, 3, 3) . ' ' . substr($digits, 6); - } - - // Still no formatting? Use raw digits + // no formatting? Use raw digits if (!$formatted) { $formatted = $digits ?: $phoneNumber; // Use original input if digits are empty } From e92f2f714d3c5e295eb10fcc4383e880e4f8a2e4 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sun, 30 Mar 2025 20:48:12 -0400 Subject: [PATCH 11/35] Fix Ticket Assign to --- post/user/ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post/user/ticket.php b/post/user/ticket.php index 6b283571..81bfdd6a 100644 --- a/post/user/ticket.php +++ b/post/user/ticket.php @@ -576,7 +576,7 @@ if (isset($_POST['assign_ticket'])) { $agent_name = "No One"; } else { // Get & verify assigned agent details - $agent_details_sql = mysqli_query($mysqli, "SELECT user_name, user_email FROM users LEFT JOIN user_settings ON users.user_id = user_settings.user_id WHERE users.user_id = $assigned_to AND user_settings.user_role > 1"); + $agent_details_sql = mysqli_query($mysqli, "SELECT user_name, user_email FROM users LEFT JOIN user_settings ON users.user_id = user_settings.user_id WHERE users.user_id = $assigned_to AND users.user_role_id > 1"); $agent_details = mysqli_fetch_array($agent_details_sql); $agent_name = sanitizeInput($agent_details['user_name']); From 393c0b8c1191b93d6563b3cd77f906d4ccb53f3f Mon Sep 17 00:00:00 2001 From: wrongecho Date: Mon, 31 Mar 2025 08:28:22 +0100 Subject: [PATCH 12/35] Recurring invoices - Fix the delete link - Cron should only flag recurring invoices that with a next-run in the past if the recurring invoice is active --- recurring_invoice.php | 2 +- recurring_invoices.php | 2 +- scripts/cron.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/recurring_invoice.php b/recurring_invoice.php index 5bd578c6..a510f522 100644 --- a/recurring_invoice.php +++ b/recurring_invoice.php @@ -164,7 +164,7 @@ if (isset($_GET['recurring_invoice_id'])) { Force Send - + Delete diff --git a/recurring_invoices.php b/recurring_invoices.php index 7bcda6f2..2df9bf03 100644 --- a/recurring_invoices.php +++ b/recurring_invoices.php @@ -257,7 +257,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - + Delete diff --git a/scripts/cron.php b/scripts/cron.php index 46148972..3c838824 100644 --- a/scripts/cron.php +++ b/scripts/cron.php @@ -879,7 +879,7 @@ while ($row = mysqli_fetch_array($sql_recurring_invoices)) { } //End Recurring Invoices Loop // Flag any active recurring "next run" dates that are in the past -$sql_invalid_recurring_invoices = mysqli_query($mysqli, "SELECT * FROM recurring_invoices WHERE recurring_invoice_next_date < CURDATE()"); +$sql_invalid_recurring_invoices = mysqli_query($mysqli, "SELECT * FROM recurring_invoices WHERE recurring_invoice_next_date < CURDATE() AND recurring_invoice_status = 1"); while ($row = mysqli_fetch_array($sql_invalid_recurring_invoices)) { $invoice_prefix = sanitizeInput($row['recurring_invoice_prefix']); $invoice_number = intval($row['recurring_invoice_number']); From af46a1fd968e8b64f1f306c11dcbad3d14ac7cac Mon Sep 17 00:00:00 2001 From: wrongecho Date: Mon, 31 Mar 2025 08:32:14 +0100 Subject: [PATCH 13/35] Fix syntax error when adding user, thanks @fleetlognorge --- post/admin/admin_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post/admin/admin_user.php b/post/admin/admin_user.php index 632fd083..c88271b6 100644 --- a/post/admin/admin_user.php +++ b/post/admin/admin_user.php @@ -15,7 +15,7 @@ if (isset($_POST['add_user'])) { $password = password_hash(trim($_POST['password']), PASSWORD_DEFAULT); $user_specific_encryption_ciphertext = encryptUserSpecificKey(trim($_POST['password'])); - mysqli_query($mysqli, "INSERT INTO users SET user_name = '$name', user_email = '$email', user_password = '$password', user_specific_encryption_ciphertext = '$user_specific_encryption_ciphertext' user_role_id = $role"); + mysqli_query($mysqli, "INSERT INTO users SET user_name = '$name', user_email = '$email', user_password = '$password', user_specific_encryption_ciphertext = '$user_specific_encryption_ciphertext', user_role_id = $role"); $user_id = mysqli_insert_id($mysqli); From 17a906fd0363380071630410f1dc4fc6c3d8cc8b Mon Sep 17 00:00:00 2001 From: wrongecho Date: Mon, 31 Mar 2025 08:35:42 +0100 Subject: [PATCH 14/35] Users bugfixes - Fix syntax error when adding user, thanks @fleetlognorge - Fix old reference to scheduled_tickets --- post/admin/admin_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post/admin/admin_user.php b/post/admin/admin_user.php index c88271b6..862e4ea4 100644 --- a/post/admin/admin_user.php +++ b/post/admin/admin_user.php @@ -217,7 +217,7 @@ if (isset($_GET['disable_user'])) { // Un-assign tickets mysqli_query($mysqli, "UPDATE tickets SET ticket_assigned_to = 0 WHERE ticket_assigned_to = $user_id AND ticket_closed_at IS NULL"); - mysqli_query($mysqli, "UPDATE scheduled_tickets SET scheduled_ticket_assigned_to = 0 WHERE scheduled_ticket_assigned_to = $user_id"); + mysqli_query($mysqli, "UPDATE recurring_tickets SET recurring_ticket_assigned_to = 0 WHERE recurring_ticket_assigned_to = $user_id"); // Logging logAction("User", "Disable", "$session_name disabled user $name", 0, $user_id); From 2032b48ad3320af3d9654e213256dc4e14c3d221 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 31 Mar 2025 12:06:36 -0400 Subject: [PATCH 15/35] DB Update Set Country codes to default to NULL and not 1 Nullify all current country codes --- database_updates.php | 39 ++++++++++++++++++++++++++++++++--- db.sql | 14 ++++++------- includes/database_version.php | 2 +- 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/database_updates.php b/database_updates.php index 1cc29ceb..3a7a593e 100644 --- a/database_updates.php +++ b/database_updates.php @@ -3424,10 +3424,43 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.1.2'"); } - // if (CURRENT_DATABASE_VERSION == '2.1.2') { - // // Insert queries here required to update to DB version 2.1.3 + if (CURRENT_DATABASE_VERSION == '2.1.2') { + + // Update country_code to NULL for `contacts` table + mysqli_query($mysqli, "ALTER TABLE `contacts` MODIFY `contact_phone_country_code` VARCHAR(10) DEFAULT NULL"); + mysqli_query($mysqli, "ALTER TABLE `contacts` MODIFY `contact_mobile_country_code` VARCHAR(10) DEFAULT NULL"); + + // Update country_code to NULL for `locations` table + mysqli_query($mysqli, "ALTER TABLE `locations` MODIFY `location_phone_country_code` VARCHAR(10) DEFAULT NULL"); + mysqli_query($mysqli, "ALTER TABLE `locations` MODIFY `location_fax_country_code` VARCHAR(10) DEFAULT NULL"); + + // Update country_code to NULL for `vendors` table + mysqli_query($mysqli, "ALTER TABLE `vendors` MODIFY `vendor_phone_country_code` VARCHAR(10) DEFAULT NULL"); + + // Update country_code to NULL for `companies` table + mysqli_query($mysqli, "ALTER TABLE `companies` MODIFY `company_phone_country_code` VARCHAR(10) DEFAULT NULL"); + + // Set country_code to NULL for `contacts` table + mysqli_query($mysqli, "UPDATE `contacts` SET `contact_phone_country_code` = NULL"); + mysqli_query($mysqli, "UPDATE `contacts` SET `contact_mobile_country_code` = NULL"); + + // Set country_code to NULL for `locations` table + mysqli_query($mysqli, "UPDATE `locations` SET `location_phone_country_code` = NULL"); + mysqli_query($mysqli, "UPDATE `locations` SET `location_fax_country_code` = NULL"); + + // Set country_code to NULL for `vendors` table + mysqli_query($mysqli, "UPDATE `vendors` SET `vendor_phone_country_code` = NULL"); + + // Set country_code to NULL for `companies` table + mysqli_query($mysqli, "UPDATE `companies` SET `company_phone_country_code` = NULL"); + + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.1.3'"); + } + + // if (CURRENT_DATABASE_VERSION == '2.1.3') { + // // Insert queries here required to update to DB version 2.1.4 // // Then, update the database to the next sequential version - // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.1.3'"); + // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.1.4'"); // } } else { diff --git a/db.sql b/db.sql index 4a4f9959..bfb82256 100644 --- a/db.sql +++ b/db.sql @@ -546,7 +546,7 @@ CREATE TABLE `companies` ( `company_state` varchar(200) DEFAULT NULL, `company_zip` varchar(200) DEFAULT NULL, `company_country` varchar(200) DEFAULT NULL, - `company_phone_country_code` varchar(10) DEFAULT '1', + `company_phone_country_code` varchar(10) DEFAULT NULL, `company_phone` varchar(200) DEFAULT NULL, `company_email` varchar(200) DEFAULT NULL, `company_website` varchar(200) DEFAULT NULL, @@ -680,10 +680,10 @@ CREATE TABLE `contacts` ( `contact_name` varchar(200) NOT NULL, `contact_title` varchar(200) DEFAULT NULL, `contact_email` varchar(200) DEFAULT NULL, - `contact_phone_country_code` varchar(10) DEFAULT '1', + `contact_phone_country_code` varchar(10) DEFAULT NULL, `contact_phone` varchar(200) DEFAULT NULL, `contact_extension` varchar(200) DEFAULT NULL, - `contact_mobile_country_code` varchar(10) DEFAULT '1', + `contact_mobile_country_code` varchar(10) DEFAULT NULL, `contact_mobile` varchar(200) DEFAULT NULL, `contact_photo` varchar(200) DEFAULT NULL, `contact_pin` varchar(255) DEFAULT NULL, @@ -1115,10 +1115,10 @@ CREATE TABLE `locations` ( `location_city` varchar(200) DEFAULT NULL, `location_state` varchar(200) DEFAULT NULL, `location_zip` varchar(200) DEFAULT NULL, - `location_phone_country_code` varchar(10) DEFAULT '1', + `location_phone_country_code` varchar(10) DEFAULT NULL, `location_phone` varchar(200) DEFAULT NULL, `location_phone_extension` varchar(10) DEFAULT NULL, - `location_fax_country_code` varchar(10) DEFAULT '1', + `location_fax_country_code` varchar(10) DEFAULT NULL, `location_fax` varchar(200) DEFAULT NULL, `location_hours` varchar(200) DEFAULT NULL, `location_photo` varchar(200) DEFAULT NULL, @@ -2468,7 +2468,7 @@ CREATE TABLE `vendors` ( `vendor_name` varchar(200) NOT NULL, `vendor_description` varchar(200) DEFAULT NULL, `vendor_contact_name` varchar(200) DEFAULT NULL, - `vendor_phone_country_code` varchar(10) DEFAULT '1', + `vendor_phone_country_code` varchar(10) DEFAULT NULL, `vendor_phone` varchar(200) DEFAULT NULL, `vendor_extension` varchar(200) DEFAULT NULL, `vendor_email` varchar(200) DEFAULT NULL, @@ -2498,4 +2498,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-03-29 18:16:21 +-- Dump completed on 2025-03-31 12:05:41 diff --git a/includes/database_version.php b/includes/database_version.php index 021f1386..66ba4bf3 100644 --- a/includes/database_version.php +++ b/includes/database_version.php @@ -5,4 +5,4 @@ * It is used in conjunction with database_updates.php */ -DEFINE("LATEST_DATABASE_VERSION", "2.1.2"); +DEFINE("LATEST_DATABASE_VERSION", "2.1.3"); From 14d8dc6fa61da3af95d01e991331e152316e6811 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 31 Mar 2025 16:35:36 -0400 Subject: [PATCH 16/35] Fix php errors thrown when formatPhone is blank --- functions.php | 88 ++++++++++++++++++++++++++++--------------- post/user/contact.php | 2 +- 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/functions.php b/functions.php index f2d0ca37..e114a877 100644 --- a/functions.php +++ b/functions.php @@ -194,135 +194,161 @@ function truncate($text, $chars) { } function formatPhoneNumber($phoneNumber, $country_code = '', $show_country_code = false) { - // Remove all non-digit characters $digits = preg_replace('/\D/', '', $phoneNumber); $formatted = ''; + // If no digits at all, fallback early + if (strlen($digits) === 0) { + return $phoneNumber; + } + + // Helper function to safely check the first digit + $startsWith = function($str, $char) { + return isset($str[0]) && $str[0] === $char; + }; + switch ($country_code) { - case '1': // USA/Canada — (123) 456-7890 + case '1': // USA/Canada if (strlen($digits) === 10) { $formatted = '(' . substr($digits, 0, 3) . ') ' . substr($digits, 3, 3) . '-' . substr($digits, 6); } break; - case '44': // UK — 07123 456 789 - if ($digits[0] === '0') $digits = substr($digits, 1); + case '44': // UK + if ($startsWith($digits, '0')) { + $digits = substr($digits, 1); + } if (strlen($digits) === 10) { $formatted = '0' . substr($digits, 0, 4) . ' ' . substr($digits, 4, 3) . ' ' . substr($digits, 7); } break; - case '61': // Australia — 0412 345 678 - if ($digits[0] === '0') $digits = substr($digits, 1); + case '61': // Australia + if ($startsWith($digits, '0')) { + $digits = substr($digits, 1); + } if (strlen($digits) === 9) { $formatted = '0' . substr($digits, 0, 4) . ' ' . substr($digits, 4, 3) . ' ' . substr($digits, 7); } break; - case '91': // India — 91234 56789 + case '91': // India if (strlen($digits) === 10) { $formatted = substr($digits, 0, 5) . ' ' . substr($digits, 5); } break; - case '81': // Japan — 03-1234-5678 - if ($digits[0] === '0') $digits = substr($digits, 1); + case '81': // Japan + if ($startsWith($digits, '0')) { + $digits = substr($digits, 1); + } if (strlen($digits) >= 9 && strlen($digits) <= 10) { $formatted = '0' . substr($digits, 0, 2) . '-' . substr($digits, 2, 4) . '-' . substr($digits, 6); } break; - case '49': // Germany — 030 12345678 - if ($digits[0] === '0') $digits = substr($digits, 1); + case '49': // Germany + if ($startsWith($digits, '0')) { + $digits = substr($digits, 1); + } if (strlen($digits) >= 10) { $formatted = '0' . substr($digits, 0, 3) . ' ' . substr($digits, 3); } break; - case '33': // France — 01 23 45 67 89 - if ($digits[0] === '0') $digits = substr($digits, 1); + case '33': // France + if ($startsWith($digits, '0')) { + $digits = substr($digits, 1); + } if (strlen($digits) === 9) { $formatted = '0' . implode(' ', str_split($digits, 2)); } break; - case '34': // Spain — 612 345 678 + case '34': // Spain if (strlen($digits) === 9) { $formatted = substr($digits, 0, 3) . ' ' . substr($digits, 3, 3) . ' ' . substr($digits, 6); } break; - case '39': // Italy — 312 345 6789 - if ($digits[0] === '0') $digits = substr($digits, 1); + case '39': // Italy + if ($startsWith($digits, '0')) { + $digits = substr($digits, 1); + } $formatted = '0' . implode(' ', str_split($digits, 3)); break; - case '55': // Brazil — (11) 91234-5678 + case '55': // Brazil if (strlen($digits) === 11) { $formatted = '(' . substr($digits, 0, 2) . ') ' . substr($digits, 2, 5) . '-' . substr($digits, 7); } break; - case '7': // Russia — 8 (912) 345-67-89 - if ($digits[0] === '8') $digits = substr($digits, 1); + case '7': // Russia + if ($startsWith($digits, '8')) { + $digits = substr($digits, 1); + } if (strlen($digits) === 10) { $formatted = '8 (' . substr($digits, 0, 3) . ') ' . substr($digits, 3, 3) . '-' . substr($digits, 6, 2) . '-' . substr($digits, 8); } break; - case '86': // China — 138 0013 8000 + case '86': // China if (strlen($digits) === 11) { $formatted = substr($digits, 0, 3) . ' ' . substr($digits, 3, 4) . ' ' . substr($digits, 7); } break; - case '82': // South Korea — 010-1234-5678 + case '82': // South Korea if (strlen($digits) === 11) { $formatted = substr($digits, 0, 3) . '-' . substr($digits, 3, 4) . '-' . substr($digits, 7); } break; - case '62': // Indonesia — 0812 3456 7890 - if ($digits[0] !== '0') $digits = '0' . $digits; + case '62': // Indonesia + if (!$startsWith($digits, '0')) { + $digits = '0' . $digits; + } if (strlen($digits) === 12) { $formatted = substr($digits, 0, 4) . ' ' . substr($digits, 4, 4) . ' ' . substr($digits, 8); } break; - case '63': // Philippines — 0912 345 6789 + case '63': // Philippines if (strlen($digits) === 11) { $formatted = substr($digits, 0, 4) . ' ' . substr($digits, 4, 3) . ' ' . substr($digits, 7); } break; - case '234': // Nigeria — 0801 234 5678 - if ($digits[0] !== '0') $digits = '0' . $digits; + case '234': // Nigeria + if (!$startsWith($digits, '0')) { + $digits = '0' . $digits; + } if (strlen($digits) === 11) { $formatted = substr($digits, 0, 4) . ' ' . substr($digits, 4, 3) . ' ' . substr($digits, 7); } break; - case '27': // South Africa — 082 123 4567 + case '27': // South Africa if (strlen($digits) >= 9 && strlen($digits) <= 10) { $formatted = substr($digits, 0, 3) . ' ' . substr($digits, 3, 3) . ' ' . substr($digits, 6); } break; - case '971': // UAE — 050 123 4567 + case '971': // UAE if (strlen($digits) === 9) { $formatted = substr($digits, 0, 3) . ' ' . substr($digits, 3, 3) . ' ' . substr($digits, 6); } break; default: - // If no match, do nothing here and use fallback below + // fallback — do nothing, use raw digits later break; } - // no formatting? Use raw digits if (!$formatted) { - $formatted = $digits ?: $phoneNumber; // Use original input if digits are empty + $formatted = $digits ?: $phoneNumber; } return $show_country_code && $country_code ? "+$country_code $formatted" : $formatted; diff --git a/post/user/contact.php b/post/user/contact.php index 1d4552c3..1d70ef05 100644 --- a/post/user/contact.php +++ b/post/user/contact.php @@ -122,7 +122,7 @@ if (isset($_POST['edit_contact'])) { } - mysqli_query($mysqli,"UPDATE contacts SET contact_name = '$name', contact_title = '$title', contact_phone_country_code = '$phone_country_code', contact_phone = '$phone', contact_extension = '$extension', contact_mobile_country_code = '$phone_country_code', contact_mobile = '$mobile', contact_email = '$email', contact_pin = '$pin', contact_notes = '$notes', contact_important = $contact_important, contact_billing = $contact_billing, contact_technical = $contact_technical, contact_department = '$department', contact_location_id = $location_id, contact_user_id = $contact_user_id WHERE contact_id = $contact_id"); + mysqli_query($mysqli,"UPDATE contacts SET contact_name = '$name', contact_title = '$title', contact_phone_country_code = '$phone_country_code', contact_phone = '$phone', contact_extension = '$extension', contact_mobile_country_code = '$mobile_country_code', contact_mobile = '$mobile', contact_email = '$email', contact_pin = '$pin', contact_notes = '$notes', contact_important = $contact_important, contact_billing = $contact_billing, contact_technical = $contact_technical, contact_department = '$department', contact_location_id = $location_id, contact_user_id = $contact_user_id WHERE contact_id = $contact_id"); // Upload Photo if (isset($_FILES['file']['tmp_name'])) { From 36af4d11fcdca5bddfb4f33ec8717ab8bb375ebb Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 31 Mar 2025 16:52:47 -0400 Subject: [PATCH 17/35] Few more phone fixes --- post/user/location.php | 4 ++-- post/user/location_model.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/post/user/location.php b/post/user/location.php index b4d150bc..087215b1 100644 --- a/post/user/location.php +++ b/post/user/location.php @@ -17,7 +17,7 @@ if(isset($_POST['add_location'])){ mkdir("uploads/clients/$client_id"); } - mysqli_query($mysqli,"INSERT INTO locations SET location_name = '$name', location_description = '$description', location_country = '$country', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone = '$phone', location_phone_extension = '$extension', location_fax = '$fax', location_hours = '$hours', location_notes = '$notes', location_contact_id = $contact, location_client_id = $client_id"); + mysqli_query($mysqli,"INSERT INTO locations SET location_name = '$name', location_description = '$description', location_country = '$country', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone_country_code = '$phone_country_code', location_phone = '$phone', location_phone_extension = '$extension', location_fax_country_code = '$fax_country_code', location_fax = '$fax', location_hours = '$hours', location_notes = '$notes', location_contact_id = $contact, location_client_id = $client_id"); $location_id = mysqli_insert_id($mysqli); @@ -79,7 +79,7 @@ if(isset($_POST['edit_location'])){ mkdir("uploads/clients/$client_id"); } - mysqli_query($mysqli,"UPDATE locations SET location_name = '$name', location_description = '$description', location_country = '$country', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone = '$phone', location_phone_extension = '$extension', location_fax = '$fax', location_hours = '$hours', location_notes = '$notes', location_contact_id = $contact WHERE location_id = $location_id"); + mysqli_query($mysqli,"UPDATE locations SET location_name = '$name', location_description = '$description', location_country = '$country', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone_country_code = '$phone_country_code', location_phone = '$phone', location_phone_extension = '$extension', location_fax_country_code = '$fax_country_code', location_fax = '$fax', location_hours = '$hours', location_notes = '$notes', location_contact_id = $contact WHERE location_id = $location_id"); // Update Primay location in clients if primary location is checked if ($location_primary == 1) { diff --git a/post/user/location_model.php b/post/user/location_model.php index 6b33250c..a62147f8 100644 --- a/post/user/location_model.php +++ b/post/user/location_model.php @@ -10,8 +10,10 @@ $city = sanitizeInput($_POST['city']); $state = sanitizeInput($_POST['state']); $zip = sanitizeInput($_POST['zip']); $phone = preg_replace("/[^0-9]/", '',$_POST['phone']); +$phone_country_code = preg_replace("/[^0-9]/", '',$_POST['phone_country_code']); $extension = preg_replace("/[^0-9]/", '',$_POST['extension']); $fax = preg_replace("/[^0-9]/", '',$_POST['fax']); +$fax_country_code = preg_replace("/[^0-9]/", '',$_POST['fax_country_code']); $hours = sanitizeInput($_POST['hours']); $notes = sanitizeInput($_POST['notes']); $contact = intval($_POST['contact'] ?? 0); From ab463c1773f661d7a42b1d847833277954540469 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 31 Mar 2025 17:30:33 -0400 Subject: [PATCH 18/35] Tidy Phone Country code add + placeholder --- admin_settings_company.php | 2 +- ajax/ajax_contact_edit.php | 4 ++-- ajax/ajax_location_edit.php | 4 ++-- ajax/ajax_vendor_edit.php | 2 +- modals/client_add_modal.php | 8 ++++---- modals/contact_add_modal.php | 4 ++-- modals/location_add_modal.php | 4 ++-- modals/vendor_add_modal.php | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/admin_settings_company.php b/admin_settings_company.php index 3b9a3fc1..dceee89e 100644 --- a/admin_settings_company.php +++ b/admin_settings_company.php @@ -119,7 +119,7 @@ $company_initials = nullable_htmlentities(initials($company_name));
- + diff --git a/ajax/ajax_contact_edit.php b/ajax/ajax_contact_edit.php index 339ed3ee..86e7d73e 100644 --- a/ajax/ajax_contact_edit.php +++ b/ajax/ajax_contact_edit.php @@ -121,7 +121,7 @@ ob_start();
- " placeholder="Code" maxlength="4"> + " placeholder="+" maxlength="4"> @@ -141,7 +141,7 @@ ob_start();
- " placeholder="Code" maxlength="4"> + " placeholder="+" maxlength="4"> diff --git a/ajax/ajax_location_edit.php b/ajax/ajax_location_edit.php index 23098d95..fb84acbc 100644 --- a/ajax/ajax_location_edit.php +++ b/ajax/ajax_location_edit.php @@ -209,7 +209,7 @@ ob_start();
- " placeholder="Code" maxlength="4"> + @@ -229,7 +229,7 @@ ob_start();
- " placeholder="Code" maxlength="4"> + diff --git a/ajax/ajax_vendor_edit.php b/ajax/ajax_vendor_edit.php index 27c84742..b4be05c1 100644 --- a/ajax/ajax_vendor_edit.php +++ b/ajax/ajax_vendor_edit.php @@ -127,7 +127,7 @@ ob_start();
- " placeholder="Code" maxlength="4"> + diff --git a/modals/client_add_modal.php b/modals/client_add_modal.php index a83d4cd9..4aba1450 100644 --- a/modals/client_add_modal.php +++ b/modals/client_add_modal.php @@ -208,7 +208,7 @@
- + @@ -228,7 +228,7 @@
- + @@ -267,7 +267,7 @@
- + @@ -287,7 +287,7 @@
- + diff --git a/modals/contact_add_modal.php b/modals/contact_add_modal.php index a10fd71f..9586d709 100644 --- a/modals/contact_add_modal.php +++ b/modals/contact_add_modal.php @@ -101,7 +101,7 @@
- + @@ -121,7 +121,7 @@
- + diff --git a/modals/location_add_modal.php b/modals/location_add_modal.php index b12e3a1e..cdd43b99 100644 --- a/modals/location_add_modal.php +++ b/modals/location_add_modal.php @@ -184,7 +184,7 @@
- + @@ -204,7 +204,7 @@
- + diff --git a/modals/vendor_add_modal.php b/modals/vendor_add_modal.php index fc0f9154..fbd8acb3 100644 --- a/modals/vendor_add_modal.php +++ b/modals/vendor_add_modal.php @@ -77,7 +77,7 @@
- + From 0914716b8ef3c0b8671c7bfbf630d61a8e4852b7 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 31 Mar 2025 18:42:56 -0400 Subject: [PATCH 19/35] Allow user to redact client replied tickets --- ajax/ajax_ticket_reply_redact.php | 9 +-------- post/user/ticket.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ajax/ajax_ticket_reply_redact.php b/ajax/ajax_ticket_reply_redact.php index e38c2bf1..4766ad55 100644 --- a/ajax/ajax_ticket_reply_redact.php +++ b/ajax/ajax_ticket_reply_redact.php @@ -11,9 +11,6 @@ $sql = mysqli_query($mysqli, "SELECT * FROM ticket_replies ); $row = mysqli_fetch_array($sql); -$ticket_reply_type = nullable_htmlentities($row['ticket_reply_type']); -$ticket_reply_time_worked = date_create($row['ticket_reply_time_worked']); -$ticket_reply_time_worked_formatted = date_format($ticket_reply_time_worked, 'H:i:s'); $ticket_reply = nullable_htmlentities($row['ticket_reply']); $client_id = intval($row['ticket_client_id']); @@ -31,10 +28,6 @@ ob_start();
- - - -
diff --git a/post/user/ticket.php b/post/user/ticket.php index 81bfdd6a..41d31701 100644 --- a/post/user/ticket.php +++ b/post/user/ticket.php @@ -1572,6 +1572,25 @@ if (isset($_POST['edit_ticket_reply'])) { header("Location: " . $_SERVER["HTTP_REFERER"]); } +if (isset($_POST['redact_ticket_reply'])) { + + enforceUserPermission('module_support', 2); + + $ticket_reply_id = intval($_POST['ticket_reply_id']); + $ticket_reply = mysqli_real_escape_string($mysqli, $_POST['ticket_reply']); + + $client_id = intval($_POST['client_id']); + + mysqli_query($mysqli, "UPDATE ticket_replies SET ticket_reply = '$ticket_reply' WHERE ticket_reply_id = $ticket_reply_id"); + + // Logging + logAction("Ticket", "Reply", "$session_name redacted ticket_reply", $client_id, $ticket_reply_id); + + $_SESSION['alert_message'] = "Ticket reply redacted"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); +} + if (isset($_GET['archive_ticket_reply'])) { enforceUserPermission('module_support', 2); From 090f4cb56018876bc5035aaeb0e953601a3bef63 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 31 Mar 2025 19:33:07 -0400 Subject: [PATCH 20/35] Fix adding location phone extension when addign a client --- post/user/client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post/user/client.php b/post/user/client.php index bd95eb32..ff2c194e 100644 --- a/post/user/client.php +++ b/post/user/client.php @@ -54,7 +54,7 @@ if (isset($_POST['add_client'])) { // Create Location if (!empty($location_phone) || !empty($address) || !empty($city) || !empty($state) || !empty($zip)) { - mysqli_query($mysqli, "INSERT INTO locations SET location_name = 'Primary', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone_country_code = '$location_phone_country_code', location_phone = '$location_phone', location_extension = '$location_extension', location_fax_country_code = '$location_fax_country_code', location_fax = '$location_fax', location_country = '$country', location_primary = 1, location_client_id = $client_id"); + mysqli_query($mysqli, "INSERT INTO locations SET location_name = 'Primary', location_address = '$address', location_city = '$city', location_state = '$state', location_zip = '$zip', location_phone_country_code = '$location_phone_country_code', location_phone = '$location_phone', location_phone_extension = '$location_extension', location_fax_country_code = '$location_fax_country_code', location_fax = '$location_fax', location_country = '$country', location_primary = 1, location_client_id = $client_id"); //Extended Logging $extended_log_description .= ", primary location $address added"; From 1ae2da80540680b4c2335d7391f7fb511f485517 Mon Sep 17 00:00:00 2001 From: wrongecho Date: Tue, 1 Apr 2025 08:46:22 +0100 Subject: [PATCH 21/35] User activity Hide the See More button if the user can't actually access the logs due to not being an admin --- user_activity.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/user_activity.php b/user_activity.php index cf962980..287706a7 100644 --- a/user_activity.php +++ b/user_activity.php @@ -41,9 +41,11 @@ $sql_recent_logs = mysqli_query($mysqli, "SELECT * FROM logs - + + +
@@ -86,9 +88,11 @@ $sql_recent_logs = mysqli_query($mysqli, "SELECT * FROM logs ?> - + + +
Date: Tue, 1 Apr 2025 09:03:33 +0100 Subject: [PATCH 22/35] Tickets - Fix bulk assign Fix bulk assigning tickets to agents --- post/user/ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post/user/ticket.php b/post/user/ticket.php index 41d31701..8d1d8bf4 100644 --- a/post/user/ticket.php +++ b/post/user/ticket.php @@ -732,7 +732,7 @@ if (isset($_POST['bulk_assign_ticket'])) { $agent_name = "No One"; } else { // Get & verify assigned agent details - $agent_details_sql = mysqli_query($mysqli, "SELECT user_name, user_email FROM users LEFT JOIN user_settings ON users.user_id = user_settings.user_id WHERE users.user_id = $assign_to AND user_settings.user_role > 1"); + $agent_details_sql = mysqli_query($mysqli, "SELECT user_name, user_email FROM users LEFT JOIN user_settings ON users.user_id = user_settings.user_id WHERE users.user_id = $assign_to"); $agent_details = mysqli_fetch_array($agent_details_sql); $agent_name = sanitizeInput($agent_details['user_name']); From 7286248fefb50741527b8b42f3c3c9efe0cb8e21 Mon Sep 17 00:00:00 2001 From: wrongecho Date: Tue, 1 Apr 2025 09:12:24 +0100 Subject: [PATCH 23/35] Ticket assign Remove the role check altogether, its the old way of doing the roles anyway --- post/user/ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post/user/ticket.php b/post/user/ticket.php index 41d31701..2cdafddf 100644 --- a/post/user/ticket.php +++ b/post/user/ticket.php @@ -576,7 +576,7 @@ if (isset($_POST['assign_ticket'])) { $agent_name = "No One"; } else { // Get & verify assigned agent details - $agent_details_sql = mysqli_query($mysqli, "SELECT user_name, user_email FROM users LEFT JOIN user_settings ON users.user_id = user_settings.user_id WHERE users.user_id = $assigned_to AND users.user_role_id > 1"); + $agent_details_sql = mysqli_query($mysqli, "SELECT user_name, user_email FROM users WHERE users.user_id = $assigned_to"); $agent_details = mysqli_fetch_array($agent_details_sql); $agent_name = sanitizeInput($agent_details['user_name']); From 3621e99c611c113609620e9fb20ed70e7878dcba Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 1 Apr 2025 11:33:04 -0400 Subject: [PATCH 24/35] Update Changelog and app version --- CHANGELOG.md | 14 ++++++++++++++ includes/app_version.php | 2 +- mfa_enforcement.php | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d6d2a7c..287def62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,20 @@ # Changelog This file documents all notable changes made to ITFlow. +## [25.03.3] + +### Fixed +- Fix adding ITFlow user. +- Do not alert on inactive recurring invoices. +- Fix ticket user assignment including bulk assignment. +- Fix adding a location phone extension. +- Do not default to +1 Country code instead. +- Do not format numbers unless there a country code is entered. +- Fix editing network location. +- Fix ticket redaction on client replies. +- Remove more from user activity as it requires admin privledges +- Fix MFA Enforcement page. + ## [25.03.2] ### Fixed diff --git a/includes/app_version.php b/includes/app_version.php index 9496998d..8789cc27 100644 --- a/includes/app_version.php +++ b/includes/app_version.php @@ -5,4 +5,4 @@ * Update this file each time we merge develop into master. Format is YY.MM (add a .v if there is more than one release a month. */ -DEFINE("APP_VERSION", "25.03.2"); +DEFINE("APP_VERSION", "25.03.3"); diff --git a/mfa_enforcement.php b/mfa_enforcement.php index 74c0a40c..289ef2fb 100644 --- a/mfa_enforcement.php +++ b/mfa_enforcement.php @@ -1,7 +1,7 @@ Date: Tue, 1 Apr 2025 11:40:24 -0400 Subject: [PATCH 25/35] Update Changelog --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 287def62..fdeded17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,11 @@ This file documents all notable changes made to ITFlow. - Do not alert on inactive recurring invoices. - Fix ticket user assignment including bulk assignment. - Fix adding a location phone extension. -- Do not default to +1 Country code instead. -- Do not format numbers unless there a country code is entered. +- Do not default to +1 Country code, instead default to null. +- Do not format numbers unless a country code is entered. - Fix editing network location. - Fix ticket redaction on client replies. -- Remove more from user activity as it requires admin privledges +- Remove more from user activity as it requires admin privledges. - Fix MFA Enforcement page. ## [25.03.2] From 15e89c3c4ef04a2d15303122e149d3e4ea36effc Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 1 Apr 2025 17:23:44 -0400 Subject: [PATCH 26/35] Fix Bulk Assign ticket to only show ITflow users and not client users --- modals/ticket_bulk_assign_modal.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modals/ticket_bulk_assign_modal.php b/modals/ticket_bulk_assign_modal.php index fb464ca6..eb6e5948 100644 --- a/modals/ticket_bulk_assign_modal.php +++ b/modals/ticket_bulk_assign_modal.php @@ -18,9 +18,8 @@ + + +
From c273cab36ef72384587ae10b1be6d695f8fba56b Mon Sep 17 00:00:00 2001 From: wrongecho Date: Fri, 4 Apr 2025 14:50:36 +0100 Subject: [PATCH 29/35] Portal - View all ticket bugfix View all tickets should display the ticket_number rather than the database ID --- client/ticket_view_all.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ticket_view_all.php b/client/ticket_view_all.php index 50812f3b..5c33edf2 100644 --- a/client/ticket_view_all.php +++ b/client/ticket_view_all.php @@ -62,7 +62,7 @@ $all_tickets = mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticket_nu $ticket_contact_name = nullable_htmlentities($row['contact_name']); echo ""; - echo " $ticket_prefix$ticket_id"; + echo " $ticket_prefix$ticket_number"; echo " $ticket_subject"; echo "$ticket_contact_name"; echo "$ticket_status"; From a20759f1f284a8e2d5a26dac96e33b2fd8517f50 Mon Sep 17 00:00:00 2001 From: wrongecho Date: Fri, 4 Apr 2025 15:07:47 +0100 Subject: [PATCH 30/35] rm asset_mac - no longer in assets table --- global_search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global_search.php b/global_search.php index 045c6ed5..1838280f 100644 --- a/global_search.php +++ b/global_search.php @@ -702,6 +702,7 @@ if (isset($_GET['query'])) { Date: Fri, 4 Apr 2025 15:08:04 +0100 Subject: [PATCH 31/35] rm asset_mac - no longer in assets table --- global_search.php | 1 - 1 file changed, 1 deletion(-) diff --git a/global_search.php b/global_search.php index 1838280f..23b62330 100644 --- a/global_search.php +++ b/global_search.php @@ -702,7 +702,6 @@ if (isset($_GET['query'])) { Date: Fri, 4 Apr 2025 15:12:32 +0100 Subject: [PATCH 32/35] Global search - assets When global search returns an asset, include a hyperlink to the asset details as part of the asset name --- global_search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global_search.php b/global_search.php index 23b62330..7e64d5d3 100644 --- a/global_search.php +++ b/global_search.php @@ -745,9 +745,9 @@ if (isset($_GET['query'])) { ?> - + - + From a0ece18876feef67be7fae23a306a3fdd2bafa08 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 7 Apr 2025 11:59:56 -0400 Subject: [PATCH 33/35] Allow to remove additional assets in a ticket --- modals/admin_vendor_template_add_modal.php | 13 ++++++++----- post/user/ticket.php | 4 ++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modals/admin_vendor_template_add_modal.php b/modals/admin_vendor_template_add_modal.php index 4e5f5dcb..e8a2ba85 100644 --- a/modals/admin_vendor_template_add_modal.php +++ b/modals/admin_vendor_template_add_modal.php @@ -75,20 +75,23 @@
- +
-
+
- + +
-
- +
+
+ +
diff --git a/post/user/ticket.php b/post/user/ticket.php index b833774f..99f16ebd 100644 --- a/post/user/ticket.php +++ b/post/user/ticket.php @@ -203,6 +203,10 @@ if (isset($_POST['edit_ticket'])) { $additional_asset_id = intval($additional_asset); mysqli_query($mysqli, "INSERT INTO ticket_assets SET ticket_id = $ticket_id, asset_id = $additional_asset_id"); } + } else { + // If no additional assets are provided, delete them all + // This handles cases where the assets input might be cleared or not set at all. + mysqli_query($mysqli, "DELETE FROM ticket_assets WHERE ticket_id = $ticket_id"); } // Get contact/ticket details after update for logging / email purposes From 70cb0ac635d0c67a62266105e7bb7e0561427ae6 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 7 Apr 2025 12:58:55 -0400 Subject: [PATCH 34/35] Add the ability to remove additional assets from the ticket details screen --- CHANGELOG.md | 7 ++++++ modals/ticket_add_watcher_modal.php | 2 +- post/user/ticket.php | 35 +++++++++++++++++++++++++++++ ticket.php | 5 +++++ 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdeded17..23ffaaf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog This file documents all notable changes made to ITFlow. + +## [25.03.4] + +### Fixed + + + ## [25.03.3] ### Fixed diff --git a/modals/ticket_add_watcher_modal.php b/modals/ticket_add_watcher_modal.php index c1c47e53..ab6a1cf3 100644 --- a/modals/ticket_add_watcher_modal.php +++ b/modals/ticket_add_watcher_modal.php @@ -21,7 +21,7 @@