mirror of https://github.com/itflow-org/itflow
Tickets can not be categorized in bulk
This commit is contained in:
parent
1b8cd5630a
commit
33beae68e5
|
|
@ -0,0 +1,42 @@
|
|||
<div class="modal" id="bulkEditCategoryTicketModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-layer-group mr-2"></i>Bulk Categorizing Selected Tickets:</strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Category</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-layer-group"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="bulk_category">
|
||||
<option value="0">- Uncategorized -</option>
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Ticket' AND category_archived_at IS NULL");
|
||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||
$category_id = intval($row['category_id']);
|
||||
$category_name = nullable_htmlentities($row['category_name']);
|
||||
|
||||
?>
|
||||
<option value="<?php echo $category_id; ?>"><?php echo $category_name; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="bulk_edit_ticket_category" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Bulk Edit</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -827,6 +827,54 @@ if (isset($_POST['bulk_edit_ticket_priority'])) {
|
|||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_POST['bulk_edit_ticket_category'])) {
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
// POST variables
|
||||
$category_id = intval($_POST['bulk_category']);
|
||||
|
||||
// Assign Tech to Selected Tickets
|
||||
if (isset($_POST['ticket_ids'])) {
|
||||
|
||||
// Get a Ticket Count
|
||||
$ticket_count = count($_POST['ticket_ids']);
|
||||
|
||||
foreach ($_POST['ticket_ids'] as $ticket_id) {
|
||||
$ticket_id = intval($ticket_id);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_subject, category_name, ticket_client_id FROM tickets LEFT JOIN categories ON ticket_category = category_id WHERE ticket_id = $ticket_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
|
||||
$ticket_prefix = sanitizeInput($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
$ticket_subject = sanitizeInput($row['ticket_subject']);
|
||||
$previous_ticket_category_name = sanitizeInput($row['category_name']);
|
||||
$client_id = intval($row['ticket_client_id']);
|
||||
|
||||
// Get Category Name
|
||||
$sql = mysqli_query($mysqli, "SELECT category_name FROM categories WHERE category_id = $category_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$category_name = sanitizeInput($row['category_name']);
|
||||
|
||||
// Update ticket
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_category = '$category_id' WHERE ticket_id = $ticket_id");
|
||||
|
||||
// Logging
|
||||
logAction("Ticket", "Edit", "$session_name updated the category on ticket $ticket_prefix$ticket_number - $ticket_subject from $previous_category_name to $category_name", $client_id, $ticket_id);
|
||||
|
||||
customAction('ticket_update', $ticket_id);
|
||||
} // End For Each Ticket ID Loop
|
||||
|
||||
// Logging
|
||||
logAction("Ticket", " Bulk Edit", "$session_name updated the category to $category_name on $ticket_count");
|
||||
|
||||
$_SESSION['alert_message'] = "Category set to $category_name for <strong>$ticket_count</strong> Tickets";
|
||||
}
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_POST['bulk_merge_tickets'])) {
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
|
|
|||
|
|
@ -229,6 +229,10 @@ $sql_categories = mysqli_query(
|
|||
<i class="fas fa-fw fa-user-check mr-2"></i>Assign Tech
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditCategoryTicketModal">
|
||||
<i class="fas fa-fw fa-layer-group mr-2"></i>Set Category
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditPriorityTicketModal">
|
||||
<i class="fas fa-fw fa-thermometer-half mr-2"></i>Update Priority
|
||||
</a>
|
||||
|
|
@ -398,5 +402,4 @@ if (isset($_GET["view"])) {
|
|||
|
||||
<?php
|
||||
require_once "modals/ticket_add_modal.php";
|
||||
|
||||
require_once "includes/footer.php";
|
||||
|
|
@ -269,6 +269,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<?php require_once "modals/ticket_bulk_assign_modal.php"; ?>
|
||||
<?php require_once "modals/ticket_bulk_edit_category_modal.php"; ?>
|
||||
<?php require_once "modals/ticket_bulk_edit_priority_modal.php"; ?>
|
||||
<?php require_once "modals/ticket_bulk_add_project_modal.php"; ?>
|
||||
<?php require_once "modals/ticket_bulk_reply_modal.php"; ?>
|
||||
|
|
|
|||
|
|
@ -278,6 +278,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<?php require_once "modals/ticket_bulk_assign_modal.php"; ?>
|
||||
<?php require_once "modals/ticket_bulk_edit_category_modal.php"; ?>
|
||||
<?php require_once "modals/ticket_bulk_edit_priority_modal.php"; ?>
|
||||
<?php require_once "modals/ticket_bulk_add_project_modal.php"; ?>
|
||||
<?php require_once "modals/ticket_bulk_reply_modal.php"; ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue