From a0ece18876feef67be7fae23a306a3fdd2bafa08 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 7 Apr 2025 11:59:56 -0400 Subject: [PATCH] Allow to remove additional assets in a ticket --- modals/admin_vendor_template_add_modal.php | 13 ++++++++----- post/user/ticket.php | 4 ++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modals/admin_vendor_template_add_modal.php b/modals/admin_vendor_template_add_modal.php index 4e5f5dcb..e8a2ba85 100644 --- a/modals/admin_vendor_template_add_modal.php +++ b/modals/admin_vendor_template_add_modal.php @@ -75,20 +75,23 @@
- +
-
+
- + +
-
- +
+
+ +
diff --git a/post/user/ticket.php b/post/user/ticket.php index b833774f..99f16ebd 100644 --- a/post/user/ticket.php +++ b/post/user/ticket.php @@ -203,6 +203,10 @@ if (isset($_POST['edit_ticket'])) { $additional_asset_id = intval($additional_asset); mysqli_query($mysqli, "INSERT INTO ticket_assets SET ticket_id = $ticket_id, asset_id = $additional_asset_id"); } + } else { + // If no additional assets are provided, delete them all + // This handles cases where the assets input might be cleared or not set at all. + mysqli_query($mysqli, "DELETE FROM ticket_assets WHERE ticket_id = $ticket_id"); } // Get contact/ticket details after update for logging / email purposes