diff --git a/ajax/ajax_asset_edit.php b/ajax/ajax_asset_edit.php index 419945eb..2942c459 100644 --- a/ajax/ajax_asset_edit.php +++ b/ajax/ajax_asset_edit.php @@ -26,6 +26,7 @@ $asset_mac = nullable_htmlentities($row['interface_mac']); $asset_uri = nullable_htmlentities($row['asset_uri']); $asset_uri_2 = nullable_htmlentities($row['asset_uri_2']); $asset_status = nullable_htmlentities($row['asset_status']); +$asset_purchase_reference = nullable_htmlentities($row['asset_purchase_reference']); $asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']); $asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']); $asset_install_date = nullable_htmlentities($row['asset_install_date']); @@ -389,11 +390,21 @@ ob_start();
- +
+ +
+
+ +
+ +
+
+ +
diff --git a/client_asset_details.php b/client_asset_details.php index 2ea670ad..f13f998b 100644 --- a/client_asset_details.php +++ b/client_asset_details.php @@ -26,6 +26,7 @@ if (isset($_GET['asset_id'])) { $asset_uri = nullable_htmlentities($row['asset_uri']); $asset_uri_2 = nullable_htmlentities($row['asset_uri_2']); $asset_status = nullable_htmlentities($row['asset_status']); + $asset_purchase_reference = nullable_htmlentities($row['asset_purchase_reference']); $asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']); $asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']); $asset_install_date = nullable_htmlentities($row['asset_install_date']); @@ -203,8 +204,6 @@ if (isset($_GET['asset_id'])) { $software_count = mysqli_num_rows($sql_related_software); - - ?>
diff --git a/client_assets.php b/client_assets.php index 736614e2..29b23d74 100644 --- a/client_assets.php +++ b/client_assets.php @@ -375,6 +375,7 @@ if (mysqli_num_rows($os_sql) > 0) { $asset_uri = nullable_htmlentities($row['asset_uri']); $asset_uri_2 = nullable_htmlentities($row['asset_uri_2']); $asset_status = nullable_htmlentities($row['asset_status']); + $asset_purchase_reference = nullable_htmlentities($row['asset_purchase_reference']); $asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']); if ($asset_purchase_date) { $asset_purchase_date_display = $asset_purchase_date; diff --git a/database_updates.php b/database_updates.php index 287a3684..de2b81ad 100644 --- a/database_updates.php +++ b/database_updates.php @@ -2500,10 +2500,15 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.3'"); } - // if (CURRENT_DATABASE_VERSION == '1.8.3') { - // // Insert queries here required to update to DB version 1.8.4 + if (CURRENT_DATABASE_VERSION == '1.8.3') { + mysqli_query($mysqli, "ALTER TABLE `assets` ADD `asset_purchase_reference` VARCHAR(200) DEFAULT NULL AFTER `asset_status`"); + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.4'"); + } + + // if (CURRENT_DATABASE_VERSION == '1.8.4') { + // // Insert queries here required to update to DB version 1.8.5 // // Then, update the database to the next sequential version - // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.4'"); + // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.5'"); // } } else { diff --git a/db.sql b/db.sql index c03a9f31..15f49327 100644 --- a/db.sql +++ b/db.sql @@ -223,6 +223,7 @@ CREATE TABLE `assets` ( `asset_uri` varchar(500) DEFAULT NULL, `asset_uri_2` varchar(500) DEFAULT NULL, `asset_status` varchar(200) DEFAULT NULL, + `asset_purchase_reference` varchar(200) DEFAULT NULL, `asset_purchase_date` date DEFAULT NULL, `asset_warranty_expire` date DEFAULT NULL, `asset_install_date` date DEFAULT NULL, @@ -1279,6 +1280,20 @@ CREATE TABLE `projects` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `quote_files` +-- + +DROP TABLE IF EXISTS `quote_files`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `quote_files` ( + `quote_id` int(11) NOT NULL, + `file_id` int(11) NOT NULL, + PRIMARY KEY (`quote_id`,`file_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `quotes` -- @@ -1308,20 +1323,6 @@ CREATE TABLE `quotes` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `quote_files` --- - -DROP TABLE IF EXISTS `quote_files`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `quote_files` ( - `quote_id` int(11) NOT NULL, - `file_id` int(11) NOT NULL, - PRIMARY KEY (`quote_id`,`file_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `rack_units` -- @@ -2362,4 +2363,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-02-12 17:12:46 +-- Dump completed on 2025-02-18 17:21:45 diff --git a/includes/database_version.php b/includes/database_version.php index aa245b7a..40929937 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", "1.8.3"); +DEFINE("LATEST_DATABASE_VERSION", "1.8.4"); diff --git a/modals/client_asset_add_modal.php b/modals/client_asset_add_modal.php index c7889c48..c7525fd2 100644 --- a/modals/client_asset_add_modal.php +++ b/modals/client_asset_add_modal.php @@ -316,11 +316,21 @@
- +
+ +
+
+ +
+ +
+
+ +
diff --git a/post/user/asset.php b/post/user/asset.php index 87b78193..52709ede 100644 --- a/post/user/asset.php +++ b/post/user/asset.php @@ -16,7 +16,7 @@ if (isset($_POST['add_asset'])) { $alert_extended = ""; - mysqli_query($mysqli,"INSERT INTO assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_uri = '$uri', asset_uri_2 = '$uri_2', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_physical_location = '$physical_location', asset_notes = '$notes', asset_client_id = $client_id"); + mysqli_query($mysqli,"INSERT INTO assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_uri = '$uri', asset_uri_2 = '$uri_2', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_reference = '$purchase_reference', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_physical_location = '$physical_location', asset_notes = '$notes', asset_client_id = $client_id"); $asset_id = mysqli_insert_id($mysqli); @@ -83,7 +83,7 @@ if (isset($_POST['edit_asset'])) { $row = mysqli_fetch_array($sql); $existing_file_name = sanitizeInput($row['asset_photo']); - mysqli_query($mysqli,"UPDATE assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_uri = '$uri', asset_uri_2 = '$uri_2', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_physical_location = '$physical_location', asset_notes = '$notes' WHERE asset_id = $asset_id"); + mysqli_query($mysqli,"UPDATE assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_uri = '$uri', asset_uri_2 = '$uri_2', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_reference = '$purchase_reference', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_physical_location = '$physical_location', asset_notes = '$notes' WHERE asset_id = $asset_id"); $sql_interfaces = mysqli_query($mysqli, "SELECT * FROM asset_interfaces WHERE interface_asset_id = $asset_id AND interface_primary = 1"); diff --git a/post/user/asset_model.php b/post/user/asset_model.php index 5289629f..bb2a1256 100644 --- a/post/user/asset_model.php +++ b/post/user/asset_model.php @@ -24,6 +24,7 @@ $physical_location = sanitizeInput($_POST['physical_location']); $vendor = intval($_POST['vendor']); $contact = intval($_POST['contact']); $network = intval($_POST['network']); +$purchase_reference = sanitizeInput($_POST['purchase_reference']); $purchase_date = sanitizeInput($_POST['purchase_date']); if (empty($purchase_date)) { $purchase_date = "NULL";