From 0aec371ccd296f5695fb4373ad2eb67db3fc6081 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 18 Feb 2022 00:27:00 -0500 Subject: [PATCH] Add Software Licnee Version and License Type as well as the beginnings to assign licneses to devices and or users --- check_login.php | 23 ++++++------ client_software.php | 2 ++ client_software_add_modal.php | 20 +++++++++++ client_software_edit_modal.php | 22 +++++++++++- db.sql | 66 +++++++++++++++++++++++++--------- post.php | 8 +++-- 6 files changed, 110 insertions(+), 31 deletions(-) diff --git a/check_login.php b/check_login.php index 1574b49a..240a1a28 100644 --- a/check_login.php +++ b/check_login.php @@ -1,13 +1,13 @@ + +
+ +
+
+ +
+ +
+
@@ -54,6 +64,16 @@
+
+ +
+
+ +
+ +
+
+
diff --git a/client_software_edit_modal.php b/client_software_edit_modal.php index 8fe514ae..c50c1fd4 100644 --- a/client_software_edit_modal.php +++ b/client_software_edit_modal.php @@ -39,6 +39,16 @@
+ +
+ +
+
+ +
+ +
+
@@ -53,6 +63,16 @@
+ +
+ +
+
+ +
+ +
+
@@ -60,7 +80,7 @@
- +
diff --git a/db.sql b/db.sql index 17bcf965..3d1520d4 100644 --- a/db.sql +++ b/db.sql @@ -1,8 +1,8 @@ --- MariaDB dump 10.19 Distrib 10.5.13-MariaDB, for debian-linux-gnu (x86_64) +-- MariaDB dump 10.19 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) -- -- Host: localhost Database: pittpc_crm -- ------------------------------------------------------ --- Server version 10.5.13-MariaDB-1:10.5.13+maria~focal +-- Server version 10.5.15-MariaDB-1:10.5.15+maria~focal /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -412,6 +412,7 @@ CREATE TABLE `documents` ( `document_created_at` datetime NOT NULL, `document_updated_at` datetime DEFAULT NULL, `document_archived_at` datetime DEFAULT NULL, + `document_folder_id` int(11) DEFAULT NULL, `document_client_id` int(11) NOT NULL, `company_id` int(11) NOT NULL, PRIMARY KEY (`document_id`) @@ -529,6 +530,21 @@ CREATE TABLE `files` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `folders` +-- + +DROP TABLE IF EXISTS `folders`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `folders` ( + `folder_id` int(11) NOT NULL AUTO_INCREMENT, + `folder_name` varchar(200) NOT NULL, + `company_id` int(11) NOT NULL, + PRIMARY KEY (`folder_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `history` -- @@ -1087,7 +1103,9 @@ DROP TABLE IF EXISTS `software`; CREATE TABLE `software` ( `software_id` int(11) NOT NULL AUTO_INCREMENT, `software_name` varchar(200) NOT NULL, + `software_version` varchar(200) DEFAULT NULL, `software_type` varchar(200) NOT NULL, + `software_license_type` varchar(200) DEFAULT NULL, `software_license` varchar(200) DEFAULT NULL, `software_notes` text DEFAULT NULL, `software_created_at` datetime NOT NULL, @@ -1100,6 +1118,34 @@ CREATE TABLE `software` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `software_assets` +-- + +DROP TABLE IF EXISTS `software_assets`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `software_assets` ( + `software_id` int(11) NOT NULL, + `asset_id` int(11) NOT NULL, + PRIMARY KEY (`software_id`,`asset_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `software_contacts` +-- + +DROP TABLE IF EXISTS `software_contacts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `software_contacts` ( + `software_id` int(11) NOT NULL, + `contact_id` int(11) NOT NULL, + PRIMARY KEY (`software_id`,`contact_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `tags` -- @@ -1241,20 +1287,6 @@ CREATE TABLE `trips` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `user_clients` --- - -DROP TABLE IF EXISTS `user_clients`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `user_clients` ( - `user_id` int(11) NOT NULL, - `client_id` int(11) NOT NULL, - PRIMARY KEY (`user_id`,`client_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `user_companies` -- @@ -1366,4 +1398,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-02-05 16:40:40 +-- Dump completed on 2022-02-18 0:26:14 diff --git a/post.php b/post.php index b06bb535..383ea048 100644 --- a/post.php +++ b/post.php @@ -4599,11 +4599,13 @@ if(isset($_POST['add_software'])){ $client_id = intval($_POST['client_id']); $name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']))); + $version = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['version']))); $type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['type']))); $license = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['license']))); + $license_type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['license_type']))); $notes = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['notes']))); - mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_type = '$type', software_license = '$license', software_notes = '$notes', software_created_at = NOW(), software_client_id = $client_id, company_id = $session_company_id"); + mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_type = '$type', software_license = '$license', software_license_type = '$license_type', software_notes = '$notes', software_created_at = NOW(), software_client_id = $client_id, company_id = $session_company_id"); if(!empty($_POST['username'])) { $software_id = mysqli_insert_id($mysqli); @@ -4628,13 +4630,15 @@ if(isset($_POST['edit_software'])){ $software_id = intval($_POST['software_id']); $login_id = intval($_POST['login_id']); $name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']))); + $version = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['version']))); $type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['type']))); $license = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['license']))); + $license_type = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['license_type']))); $notes = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['notes']))); $username = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['username']))); $password = trim(mysqli_real_escape_string($mysqli,encryptLoginEntry($_POST['password']))); - mysqli_query($mysqli,"UPDATE software SET software_name = '$name', software_type = '$type', software_license = '$license', software_notes = '$notes', software_updated_at = NOW() WHERE software_id = $software_id AND company_id = $session_company_id"); + mysqli_query($mysqli,"UPDATE software SET software_name = '$name', software_version = '$version', software_type = '$type', software_license = '$license', software_license_type = '$license_type', software_notes = '$notes', software_updated_at = NOW() WHERE software_id = $software_id AND company_id = $session_company_id"); //If login exists then update the login if($login_id > 0){