From 6c80fa177dfa1e4349465f9f8bab5fb996020be9 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 8 Nov 2021 18:07:36 -0500 Subject: [PATCH] DB Update, reworked upcoming tagging feature in SQL, Added Province and Postal Code to address labels, changed the field document_details to document_content in SQL --- add_client_modal.php | 101 ++++++++++++++++++++-------------------- add_company_modal.php | 8 ++-- add_document_modal.php | 2 +- add_location_modal.php | 12 ++--- add_vendor_modal.php | 10 ++-- client_documents.php | 4 +- db.sql | 42 +++++++++++++++-- edit_client_modal.php | 10 ++-- edit_company_modal.php | 8 ++-- edit_document_modal.php | 2 +- edit_location_modal.php | 12 ++--- edit_vendor_modal.php | 10 ++-- post.php | 8 ++-- setup.php | 8 ++-- view_document_modal.php | 2 +- 15 files changed, 137 insertions(+), 102 deletions(-) diff --git a/add_client_modal.php b/add_client_modal.php index 147822ca..68a7f8d1 100644 --- a/add_client_modal.php +++ b/add_client_modal.php @@ -21,7 +21,7 @@ Contact @@ -42,7 +42,7 @@
- +
@@ -51,19 +51,6 @@
-
- -
-
- -
- -
-
-
@@ -90,35 +77,6 @@
-
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
-
@@ -144,22 +102,22 @@
- +
- +
- +
- +
@@ -252,10 +210,53 @@ -
+
- + +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
diff --git a/add_company_modal.php b/add_company_modal.php index c819aa19..d55e38b8 100644 --- a/add_company_modal.php +++ b/add_company_modal.php @@ -41,22 +41,22 @@
- +
- +
- +
- +
diff --git a/add_document_modal.php b/add_document_modal.php index 41d714f3..cc962216 100644 --- a/add_document_modal.php +++ b/add_document_modal.php @@ -16,7 +16,7 @@
- +
diff --git a/add_location_modal.php b/add_location_modal.php index ad38b46e..5b2b81f1 100644 --- a/add_location_modal.php +++ b/add_location_modal.php @@ -30,7 +30,7 @@
- +
@@ -50,7 +50,7 @@
- +
@@ -65,22 +65,22 @@
- +
- +
- +
- +
diff --git a/add_vendor_modal.php b/add_vendor_modal.php index 98aef41e..36ebefea 100644 --- a/add_vendor_modal.php +++ b/add_vendor_modal.php @@ -74,7 +74,7 @@
- +
@@ -89,22 +89,22 @@
- +
- +
- +
- +
diff --git a/client_documents.php b/client_documents.php index 7f64999b..ae258d0d 100644 --- a/client_documents.php +++ b/client_documents.php @@ -42,7 +42,7 @@ $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o $sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM documents WHERE document_client_id = $client_id AND documents.company_id = $session_company_id - AND (document_name LIKE '%$q%' OR document_details LIKE '%$q%') + AND (document_name LIKE '%$q%' OR document_content LIKE '%$q%') ORDER BY $sb $o LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); @@ -93,7 +93,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); while($row = mysqli_fetch_array($sql)){ $document_id = $row['document_id']; $document_name = $row['document_name']; - $document_details = $row['document_details']; + $document_content = $row['document_content']; $document_created_at = $row['document_created_at']; $document_updated_at = $row['document_updated_at']; diff --git a/db.sql b/db.sql index 5e9621de..f37765d2 100644 --- a/db.sql +++ b/db.sql @@ -175,6 +175,22 @@ CREATE TABLE `certificates` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `client_tags` +-- + +DROP TABLE IF EXISTS `client_tags`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `client_tags` ( + `client_tag_id` int(11) NOT NULL AUTO_INCREMENT, + `client_id` int(11) NOT NULL, + `tag_id` int(11) NOT NULL, + `client_tag_created_at` datetime NOT NULL, + PRIMARY KEY (`client_tag_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `clients` -- @@ -186,13 +202,11 @@ CREATE TABLE `clients` ( `client_id` int(11) NOT NULL AUTO_INCREMENT, `client_name` varchar(200) NOT NULL, `client_type` varchar(200) DEFAULT NULL, - `client_contact` varchar(200) DEFAULT NULL, `client_website` varchar(200) DEFAULT NULL, `client_referral` varchar(200) DEFAULT NULL, `client_currency_code` varchar(200) NOT NULL, `client_net_terms` int(10) NOT NULL, `client_support` varchar(100) DEFAULT NULL, - `client_tags` text DEFAULT NULL, `client_notes` text DEFAULT NULL, `client_created_at` datetime NOT NULL, `client_updated_at` datetime DEFAULT NULL, @@ -310,7 +324,7 @@ DROP TABLE IF EXISTS `documents`; CREATE TABLE `documents` ( `document_id` int(11) NOT NULL AUTO_INCREMENT, `document_name` varchar(200) NOT NULL, - `document_details` longtext NOT NULL, + `document_content` longtext NOT NULL, `document_created_at` datetime NOT NULL, `document_updated_at` datetime DEFAULT NULL, `document_archived_at` datetime DEFAULT NULL, @@ -867,6 +881,26 @@ CREATE TABLE `software` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `tags` +-- + +DROP TABLE IF EXISTS `tags`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tags` ( + `tag_id` int(11) NOT NULL AUTO_INCREMENT, + `tag_name` varchar(200) NOT NULL, + `tag_color` varchar(200) DEFAULT NULL, + `tag_icon` varchar(200) DEFAULT NULL, + `tag_created_at` datetime NOT NULL, + `tag_updated_at` datetime DEFAULT NULL, + `tag_archived_at` datetime DEFAULT NULL, + `company_id` int(11) NOT NULL, + PRIMARY KEY (`tag_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `taxes` -- @@ -1064,4 +1098,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2021-09-21 22:22:21 +-- Dump completed on 2021-11-08 18:05:26 diff --git a/edit_client_modal.php b/edit_client_modal.php index 636cb07a..84e4bdca 100644 --- a/edit_client_modal.php +++ b/edit_client_modal.php @@ -133,7 +133,7 @@
- + @@ -148,22 +148,22 @@
- +
- +
- +
- +
diff --git a/edit_company_modal.php b/edit_company_modal.php index 7618d249..a83e44f1 100644 --- a/edit_company_modal.php +++ b/edit_company_modal.php @@ -43,22 +43,22 @@
- +
- +
- +
- +
diff --git a/edit_document_modal.php b/edit_document_modal.php index d28d1025..a9ef3fe5 100644 --- a/edit_document_modal.php +++ b/edit_document_modal.php @@ -16,7 +16,7 @@
- +
diff --git a/edit_location_modal.php b/edit_location_modal.php index 9ef9e527..89c58abf 100644 --- a/edit_location_modal.php +++ b/edit_location_modal.php @@ -32,7 +32,7 @@
- +
@@ -52,7 +52,7 @@
- +
@@ -67,22 +67,22 @@
- +
- +
- +
- +
diff --git a/edit_vendor_modal.php b/edit_vendor_modal.php index 828b8c93..305ed1ba 100644 --- a/edit_vendor_modal.php +++ b/edit_vendor_modal.php @@ -72,7 +72,7 @@
- +
@@ -87,22 +87,22 @@
- +
- +
- +
- +
diff --git a/post.php b/post.php index 2783786d..fb7a67c1 100644 --- a/post.php +++ b/post.php @@ -4757,9 +4757,9 @@ if(isset($_POST['add_document'])){ $client_id = intval($_POST['client_id']); $name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']))); - $details = trim(mysqli_real_escape_string($mysqli,$_POST['details'])); + $content = trim(mysqli_real_escape_string($mysqli,$_POST['content'])); - mysqli_query($mysqli,"INSERT INTO documents SET document_name = '$name', document_details = '$details', document_created_at = NOW(), document_client_id = $client_id, company_id = $session_company_id"); + mysqli_query($mysqli,"INSERT INTO documents SET document_name = '$name', document_content = '$content', document_created_at = NOW(), document_client_id = $client_id, company_id = $session_company_id"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Document', log_action = 'Created', log_description = '$details', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id"); @@ -4774,9 +4774,9 @@ if(isset($_POST['edit_document'])){ $document_id = intval($_POST['document_id']); $name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']))); - $details = trim(mysqli_real_escape_string($mysqli,$_POST['details'])); + $content = trim(mysqli_real_escape_string($mysqli,$_POST['content'])); - mysqli_query($mysqli,"UPDATE documents SET document_name = '$name', document_details = '$details', document_updated_at = NOW() WHERE document_id = $document_id AND company_id = $session_company_id"); + mysqli_query($mysqli,"UPDATE documents SET document_name = '$name', document_content = '$content', document_updated_at = NOW() WHERE document_id = $document_id AND company_id = $session_company_id"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Note', log_action = 'Modified', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id"); diff --git a/setup.php b/setup.php index a7c4c4b6..f03b4bc6 100644 --- a/setup.php +++ b/setup.php @@ -823,22 +823,22 @@ if(isset($_POST['add_company_settings'])){
- +
- +
- +
- +
diff --git a/view_document_modal.php b/view_document_modal.php index 54d93692..fcfa2f0c 100644 --- a/view_document_modal.php +++ b/view_document_modal.php @@ -8,7 +8,7 @@