Added the option to bulk remove contact tags

This commit is contained in:
johnnyq 2024-06-07 18:44:21 -04:00
parent e920ccc5e4
commit a44a76db28
2 changed files with 12 additions and 1 deletions

View File

@ -9,6 +9,12 @@
</div>
<div class="modal-body bg-white">
<input type="hidden" name="bulk_remove_tags" value="0">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="bulk_remove_tags" value="1">
<label class="form-check-label text-danger">Remove Existing Tags</label>
</div>
<div class="form-group">
<label>Tags</label>

View File

@ -340,7 +340,7 @@ if (isset($_POST['bulk_assign_contact_tags'])) {
// Get Selected Contacts Count
$count = count($_POST['contact_ids']);
// Assign Location to Selected Contacts
if (!empty($_POST['contact_ids'])) {
foreach($_POST['contact_ids'] as $contact_id) {
@ -352,6 +352,11 @@ if (isset($_POST['bulk_assign_contact_tags'])) {
$contact_name = sanitizeInput($row['contact_name']);
$client_id = intval($row['contact_client_id']);
if($_POST['bulk_remove_tags']) {
// Delete tags if chosed to do so
mysqli_query($mysqli, "DELETE FROM contact_tags WHERE contact_id = $contact_id");
}
// Add new tags
foreach($_POST['bulk_tags'] as $tag) {
$tag = intval($tag);