From 7a5f8b425f53c80052baa0019cbd18094da6945b Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Sun, 9 Jan 2022 14:47:34 +0000 Subject: [PATCH] Delete tag associations for document when it is deleted --- post.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/post.php b/post.php index 0cca7d8f..69851aff 100644 --- a/post.php +++ b/post.php @@ -5201,6 +5201,9 @@ if(isset($_GET['delete_document'])){ mysqli_query($mysqli,"DELETE FROM documents WHERE document_id = $document_id AND company_id = $session_company_id"); + // Delete the tag associations to documents + mysqli_query($mysqli, "DELETE FROM documents_tagged WHERE document_id = '$document_id'"); + //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Document', log_action = 'Deleted', log_description = '$document_id', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");