diff --git a/client_document_bulk_move_modal.php b/client_document_bulk_move_modal.php new file mode 100644 index 00000000..9b5ddadf --- /dev/null +++ b/client_document_bulk_move_modal.php @@ -0,0 +1,41 @@ + diff --git a/client_documents.php b/client_documents.php index 67b3749c..c826c5d6 100644 --- a/client_documents.php +++ b/client_documents.php @@ -165,104 +165,128 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
-
- +
+
+
+ +
-
- - "> - - - - - - - - - +
- Name - - Created - - Last Update - - Action -
+ "> + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - -
+
+ +
+
+ Name + + Created + + Last Update + + Action +
+
+ +
+
+ +
+
+ +
+
+ +
- -
-
- -
-
- -
-
-
+ + +
+ + +
@@ -270,6 +294,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + + + diff --git a/client_files.php b/client_files.php index 196a11e6..86231d60 100644 --- a/client_files.php +++ b/client_files.php @@ -157,9 +157,21 @@ $num_of_files = mysqli_num_rows($sql);
-
+
"> "> + + +
@@ -213,96 +225,109 @@ $num_of_files = mysqli_num_rows($sql); -
- - - "> - - - - - - - - - - + +
+
NameUploadedAction
+ + "> - - - + + + + + + + - require "client_file_move_modal.php"; + + + + + + + - + require "client_file_move_modal.php"; -
" target="_blank" class="text-secondary"> - +
+
NameUploadedAction
+
+ +
+
" target="_blank" class="text-secondary"> + +
-
- + } + ?> + + + + + + @@ -314,6 +339,8 @@ $num_of_files = mysqli_num_rows($sql); + + $document_count documents to the folder $folder_name"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} + if (isset($_POST['link_file_to_document'])) { validateTechRole(); diff --git a/post/file.php b/post/file.php index 1f702c19..46d24668 100644 --- a/post/file.php +++ b/post/file.php @@ -143,3 +143,41 @@ if (isset($_POST['delete_file'])) { header("Location: " . $_SERVER["HTTP_REFERER"]); } + +if (isset($_POST['bulk_move_files'])) { + + validateTechRole(); + + $folder_id = intval($_POST['bulk_folder_id']); + + // Get folder name for logging and Notification + $sql = mysqli_query($mysqli,"SELECT folder_name, folder_client_id FROM folders WHERE folder_id = $folder_id"); + $row = mysqli_fetch_array($sql); + $folder_name = sanitizeInput($row['folder_name']); + $client_id = intval($row['folder_client_id']); + + // Get Selected file Count + $file_count = count($_POST['file_ids']); + + // Move Documents to Folder Loop + if (!empty($_POST['file_ids'])) { + foreach($_POST['file_ids'] as $file_id) { + $file_id = intval($file_id); + // Get file name for logging + $sql = mysqli_query($mysqli,"SELECT file_name FROM files WHERE file_id = $file_id"); + $row = mysqli_fetch_array($sql); + $file_name = sanitizeInput($row['file_name']); + + // file move query + mysqli_query($mysqli,"UPDATE files SET file_folder_id = $folder_id WHERE file_id = $file_id"); + + //Logging + mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'File', log_action = 'Move', log_description = '$session_name moved file $file_name to folder $folder_name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $file_id"); + } + } + + $_SESSION['alert_message'] = "You moved $file_count files to the folder $folder_name"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +}