mirror of
https://github.com/itflow-org/itflow
synced 2026-03-01 11:24:52 +00:00
Removed Patch panel tables as they share similarities with assets and assets interfaces, rename events to calendar events and event attendees to calendar even attendees
This commit is contained in:
@@ -4,7 +4,7 @@ require_once '../includes/ajax_header.php';
|
|||||||
|
|
||||||
$event_id = intval($_GET['id']);
|
$event_id = intval($_GET['id']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id WHERE event_id = $event_id LIMIT 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id WHERE event_id = $event_id LIMIT 1");
|
||||||
|
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
$event_title = nullable_htmlentities($row['event_title']);
|
$event_title = nullable_htmlentities($row['event_title']);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ require_once "modals/calendar_add_modal.php";
|
|||||||
|
|
||||||
|
|
||||||
//loop through IDs and create a modal for each
|
//loop through IDs and create a modal for each
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
$sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$event_id = intval($row['event_id']);
|
$event_id = intval($row['event_id']);
|
||||||
$event_title = nullable_htmlentities($row['event_title']);
|
$event_title = nullable_htmlentities($row['event_title']);
|
||||||
@@ -170,7 +170,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
},
|
},
|
||||||
events: [
|
events: [
|
||||||
<?php
|
<?php
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
$sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$event_id = intval($row['event_id']);
|
$event_id = intval($row['event_id']);
|
||||||
$event_title = json_encode($row['event_title']);
|
$event_title = json_encode($row['event_title']);
|
||||||
|
|||||||
@@ -2662,10 +2662,22 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.0.0'");
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.0.0'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (CURRENT_DATABASE_VERSION == '2.0.0') {
|
if (CURRENT_DATABASE_VERSION == '2.0.0') {
|
||||||
// // Insert queries here required to update to DB version 2.0.1
|
|
||||||
|
//Dropping patch panel as a patch panel can be documented as an asset with interfaces.
|
||||||
|
mysqli_query($mysqli, "DROP TABLE `patch_panel_ports`");
|
||||||
|
mysqli_query($mysqli, "DROP TABLE `patch_panels`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "RENAME TABLE `events` TO `calendar_events`");
|
||||||
|
mysqli_query($mysqli, "RENAME TABLE `event_attendees` TO `calendar_event_attendees`");
|
||||||
|
|
||||||
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.0.1'");
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (CURRENT_DATABASE_VERSION == '2.0.1') {
|
||||||
|
// // Insert queries here required to update to DB version 2.0.2
|
||||||
// // Then, update the database to the next sequential version
|
// // Then, update the database to the next sequential version
|
||||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.0.1'");
|
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.0.2'");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
143
db.sql
143
db.sql
@@ -299,6 +299,52 @@ CREATE TABLE `budget` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `calendar_event_attendees`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `calendar_event_attendees`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `calendar_event_attendees` (
|
||||||
|
`attendee_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`attendee_name` varchar(200) DEFAULT NULL,
|
||||||
|
`attendee_email` varchar(200) DEFAULT NULL,
|
||||||
|
`attendee_invitation_status` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
|
`attendee_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||||
|
`attendee_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
||||||
|
`attendee_archived_at` datetime DEFAULT NULL,
|
||||||
|
`attendee_contact_id` int(11) NOT NULL DEFAULT 0,
|
||||||
|
`attendee_event_id` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`attendee_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `calendar_events`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `calendar_events`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `calendar_events` (
|
||||||
|
`event_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`event_title` varchar(200) NOT NULL,
|
||||||
|
`event_location` text DEFAULT NULL,
|
||||||
|
`event_description` longtext DEFAULT NULL,
|
||||||
|
`event_start` datetime NOT NULL,
|
||||||
|
`event_end` datetime DEFAULT NULL,
|
||||||
|
`event_repeat` varchar(200) DEFAULT NULL,
|
||||||
|
`event_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||||
|
`event_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
||||||
|
`event_archived_at` datetime DEFAULT NULL,
|
||||||
|
`event_client_id` int(11) NOT NULL DEFAULT 0,
|
||||||
|
`event_location_id` int(11) NOT NULL DEFAULT 0,
|
||||||
|
`event_calendar_id` int(11) NOT NULL DEFAULT 0,
|
||||||
|
PRIMARY KEY (`event_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `calendars`
|
-- Table structure for table `calendars`
|
||||||
--
|
--
|
||||||
@@ -837,52 +883,6 @@ CREATE TABLE `email_queue` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `event_attendees`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `event_attendees`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `event_attendees` (
|
|
||||||
`attendee_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`attendee_name` varchar(200) DEFAULT NULL,
|
|
||||||
`attendee_email` varchar(200) DEFAULT NULL,
|
|
||||||
`attendee_invitation_status` tinyint(1) NOT NULL DEFAULT 0,
|
|
||||||
`attendee_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
|
||||||
`attendee_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
|
||||||
`attendee_archived_at` datetime DEFAULT NULL,
|
|
||||||
`attendee_contact_id` int(11) NOT NULL DEFAULT 0,
|
|
||||||
`attendee_event_id` int(11) NOT NULL,
|
|
||||||
PRIMARY KEY (`attendee_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `events`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `events`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `events` (
|
|
||||||
`event_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`event_title` varchar(200) NOT NULL,
|
|
||||||
`event_location` text DEFAULT NULL,
|
|
||||||
`event_description` longtext DEFAULT NULL,
|
|
||||||
`event_start` datetime NOT NULL,
|
|
||||||
`event_end` datetime DEFAULT NULL,
|
|
||||||
`event_repeat` varchar(200) DEFAULT NULL,
|
|
||||||
`event_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
|
||||||
`event_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
|
||||||
`event_archived_at` datetime DEFAULT NULL,
|
|
||||||
`event_client_id` int(11) NOT NULL DEFAULT 0,
|
|
||||||
`event_location_id` int(11) NOT NULL DEFAULT 0,
|
|
||||||
`event_calendar_id` int(11) NOT NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`event_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `expenses`
|
-- Table structure for table `expenses`
|
||||||
--
|
--
|
||||||
@@ -1170,55 +1170,6 @@ CREATE TABLE `notifications` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `patch_panel_ports`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `patch_panel_ports`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `patch_panel_ports` (
|
|
||||||
`port_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`port_number` int(11) NOT NULL,
|
|
||||||
`port_name` varchar(200) DEFAULT NULL,
|
|
||||||
`port_description` text DEFAULT NULL,
|
|
||||||
`port_type` varchar(200) DEFAULT NULL,
|
|
||||||
`port_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
|
||||||
`port_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
|
||||||
`port_archived_at` datetime DEFAULT NULL,
|
|
||||||
`port_asset_id` int(11) DEFAULT NULL,
|
|
||||||
`port_patch_panel_id` int(11) NOT NULL,
|
|
||||||
PRIMARY KEY (`port_id`),
|
|
||||||
KEY `port_patch_panel_id` (`port_patch_panel_id`),
|
|
||||||
CONSTRAINT `patch_panel_ports_ibfk_1` FOREIGN KEY (`port_patch_panel_id`) REFERENCES `patch_panels` (`patch_panel_id`) ON DELETE CASCADE
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `patch_panels`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `patch_panels`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `patch_panels` (
|
|
||||||
`patch_panel_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`patch_panel_name` varchar(200) NOT NULL,
|
|
||||||
`patch_panel_description` text DEFAULT NULL,
|
|
||||||
`patch_panel_type` varchar(200) DEFAULT NULL,
|
|
||||||
`patch_panel_ports` int(11) NOT NULL,
|
|
||||||
`patch_panel_physical_location` varchar(200) DEFAULT NULL,
|
|
||||||
`patch_panel_notes` text DEFAULT NULL,
|
|
||||||
`patch_panel_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
|
||||||
`patch_panel_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
|
||||||
`patch_panel_archived_at` datetime DEFAULT NULL,
|
|
||||||
`patch_panel_location_id` int(11) DEFAULT NULL,
|
|
||||||
`patch_panel_rack_id` int(11) DEFAULT NULL,
|
|
||||||
`patch_panel_client_id` int(11) NOT NULL,
|
|
||||||
PRIMARY KEY (`patch_panel_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `payments`
|
-- Table structure for table `payments`
|
||||||
--
|
--
|
||||||
@@ -2451,4 +2402,4 @@ CREATE TABLE `vendors` (
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2025-03-12 21:27:39
|
-- Dump completed on 2025-03-13 16:33:22
|
||||||
|
|||||||
@@ -5,4 +5,4 @@
|
|||||||
* It is used in conjunction with database_updates.php
|
* It is used in conjunction with database_updates.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEFINE("LATEST_DATABASE_VERSION", "2.0.0");
|
DEFINE("LATEST_DATABASE_VERSION", "2.0.1");
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ if (isset($_POST['add_event'])) {
|
|||||||
require_once 'post/user/event_model.php';
|
require_once 'post/user/event_model.php';
|
||||||
|
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO events SET event_title = '$title', event_location = '$location', event_description = '$description', event_start = '$start', event_end = '$end', event_repeat = '$repeat', event_calendar_id = $calendar_id, event_client_id = $client");
|
mysqli_query($mysqli,"INSERT INTO calendar_events SET event_title = '$title', event_location = '$location', event_description = '$description', event_start = '$start', event_end = '$end', event_repeat = '$repeat', event_calendar_id = $calendar_id, event_client_id = $client");
|
||||||
|
|
||||||
$event_id = mysqli_insert_id($mysqli);
|
$event_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ if (isset($_POST['edit_event'])) {
|
|||||||
|
|
||||||
$event_id = intval($_POST['event_id']);
|
$event_id = intval($_POST['event_id']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE events SET event_title = '$title', event_location = '$location', event_description = '$description', event_start = '$start', event_end = '$end', event_repeat = '$repeat', event_calendar_id = $calendar_id, event_client_id = $client WHERE event_id = $event_id");
|
mysqli_query($mysqli,"UPDATE calendar_events SET event_title = '$title', event_location = '$location', event_description = '$description', event_start = '$start', event_end = '$end', event_repeat = '$repeat', event_calendar_id = $calendar_id, event_client_id = $client WHERE event_id = $event_id");
|
||||||
|
|
||||||
//If email is checked
|
//If email is checked
|
||||||
if ($email_event == 1) {
|
if ($email_event == 1) {
|
||||||
@@ -187,12 +187,12 @@ if (isset($_GET['delete_event'])) {
|
|||||||
$event_id = intval($_GET['delete_event']);
|
$event_id = intval($_GET['delete_event']);
|
||||||
|
|
||||||
// Get Event Title
|
// Get Event Title
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM events WHERE event_id = $event_id");
|
$sql = mysqli_query($mysqli,"SELECT * FROM calendar_events WHERE event_id = $event_id");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
$event_title = sanitizeInput($row['event_title']);
|
$event_title = sanitizeInput($row['event_title']);
|
||||||
$client_id = intval($row['event_client_id']);
|
$client_id = intval($row['event_client_id']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"DELETE FROM events WHERE event_id = $event_id");
|
mysqli_query($mysqli,"DELETE FROM calendar_events WHERE event_id = $event_id");
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
logAction("Calendar Event", "Delete", "$session_name deleted calendar event $event_title", $client_id);
|
logAction("Calendar Event", "Delete", "$session_name deleted calendar event $event_title", $client_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user