From 383897ee27c1a363c35d54639222f465b9a15fc3 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 30 Mar 2026 17:25:51 -0400 Subject: [PATCH] Assets: Moved asset status to be creatable/editable Categories with common defaults and descriptions also Add category description to add / edit modals and description underneath category name --- admin/category.php | 8 ++++++++ admin/database_updates.php | 20 +++++++++++++++---- admin/modals/category/category_add.php | 10 ++++++++++ admin/modals/category/category_edit.php | 11 ++++++++++ admin/post/category.php | 4 ++-- admin/post/category_model.php | 1 + agent/modals/asset/asset_add.php | 13 ++++++++++-- agent/modals/asset/asset_bulk_edit_status.php | 17 ++++++++++++---- agent/modals/asset/asset_copy.php | 16 +++++++++++++-- agent/modals/asset/asset_edit.php | 16 +++++++++++++-- includes/database_version.php | 2 +- includes/load_global_settings.php | 9 --------- setup/index.php | 8 ++++++++ 13 files changed, 109 insertions(+), 26 deletions(-) diff --git a/admin/category.php b/admin/category.php index 7f6008a7..6789f06f 100644 --- a/admin/category.php +++ b/admin/category.php @@ -89,6 +89,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); } else { echo 'btn-default'; } ?>">Network Interface + Asset Status @@ -128,6 +135,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); +
diff --git a/admin/database_updates.php b/admin/database_updates.php index 46a22bc7..3b787f05 100644 --- a/admin/database_updates.php +++ b/admin/database_updates.php @@ -4350,13 +4350,25 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Fiber', category_type = 'network_interface', category_order = 7"); // 7 mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'WiFi', category_type = 'network_interface', category_order = 8"); // 8 + + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.4.3'"); } - // - // // if (CURRENT_DATABASE_VERSION == '2.4.3') { - // // Insert queries here required to update to DB version 2.4.4 + + if (CURRENT_DATABASE_VERSION == '2.4.3') { + // Asset Status + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Ready to Deploy', category_description = 'Asset is configured and ready to be assigned', category_type = 'asset_status', category_order = 1"); // 1 + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Deployed', category_description = 'Asset is actively in use and assigned to a client or location', category_type = 'asset_status', category_order = 2"); // 2 + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Out for Repair', category_description = 'Asset has been sent out for servicing or repair', category_type = 'asset_status', category_order = 3"); // 3 + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Lost', category_description = 'Asset location is unknown and cannot be accounted for', category_type = 'asset_status', category_order = 4"); // 4 + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Stolen', category_description = 'Asset has been reported stolen', category_type = 'asset_status', category_order = 5"); // 5 + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Retired', category_description = 'Asset has been decommissioned and is no longer in service', category_type = 'asset_status', category_order = 6"); // 6 + } + + // if (CURRENT_DATABASE_VERSION == '2.4.4') { + // // Insert queries here required to update to DB version 2.4.5 // // Then, update the database to the next sequential version - // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.4.4'"); + // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.4.5'"); // } } else { diff --git a/admin/modals/category/category_add.php b/admin/modals/category/category_add.php index 40a53221..d4b5715c 100644 --- a/admin/modals/category/category_add.php +++ b/admin/modals/category/category_add.php @@ -60,6 +60,16 @@ $category_types_array = ['Expense', 'Income', 'Referral', 'Ticket']; +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ diff --git a/agent/modals/asset/asset_bulk_edit_status.php b/agent/modals/asset/asset_bulk_edit_status.php index 2e6407f6..6cbca8bd 100644 --- a/agent/modals/asset/asset_bulk_edit_status.php +++ b/agent/modals/asset/asset_bulk_edit_status.php @@ -26,12 +26,21 @@ ob_start();
- +
diff --git a/agent/modals/asset/asset_copy.php b/agent/modals/asset/asset_copy.php index 9b903f12..a02653a9 100644 --- a/agent/modals/asset/asset_copy.php +++ b/agent/modals/asset/asset_copy.php @@ -228,8 +228,20 @@ ob_start(); diff --git a/agent/modals/asset/asset_edit.php b/agent/modals/asset/asset_edit.php index 6d2cccc8..78cc4e37 100644 --- a/agent/modals/asset/asset_edit.php +++ b/agent/modals/asset/asset_edit.php @@ -270,8 +270,20 @@ ob_start(); diff --git a/includes/database_version.php b/includes/database_version.php index af7a117a..53c431bc 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.4.3"); +DEFINE("LATEST_DATABASE_VERSION", "2.4.4"); diff --git a/includes/load_global_settings.php b/includes/load_global_settings.php index 98429693..1fad611a 100644 --- a/includes/load_global_settings.php +++ b/includes/load_global_settings.php @@ -243,15 +243,6 @@ $document_types_array = array ( '2'=>'Global Template' ); -$asset_status_array = array ( - 'Ready to Deploy', - 'Deployed', - 'Out for Repair', - 'Lost', - 'Stolen', - 'Retired' -); - $ticket_status_array = array ( 'Open', 'On Hold', diff --git a/setup/index.php b/setup/index.php index efc5a47d..607bf2f4 100644 --- a/setup/index.php +++ b/setup/index.php @@ -593,6 +593,14 @@ if (isset($_POST['add_company_settings'])) { mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Fiber', category_type = 'network_interface', category_order = 7"); // 7 mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'WiFi', category_type = 'network_interface', category_order = 8"); // 8 + // Asset statuses + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Ready to Deploy', category_description = 'Asset is configured and ready to be assigned', category_type = 'asset_status', category_order = 1"); // 1 + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Deployed', category_description = 'Asset is actively in use and assigned to a client or location', category_type = 'asset_status', category_order = 2"); // 2 + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Out for Repair', category_description = 'Asset has been sent out for servicing or repair', category_type = 'asset_status', category_order = 3"); // 3 + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Lost', category_description = 'Asset location is unknown and cannot be accounted for', category_type = 'asset_status', category_order = 4"); // 4 + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Stolen', category_description = 'Asset has been reported stolen', category_type = 'asset_status', category_order = 5"); // 5 + mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Retired', category_description = 'Asset has been decommissioned and is no longer in service', category_type = 'asset_status', category_order = 6"); // 6 + $_SESSION['alert_message'] = "Company $name created";