mirror of https://github.com/itflow-org/itflow
alter ticket_kanban to ticket_order
This commit is contained in:
parent
3de97fcd15
commit
65bb1b4007
10
ajax.php
10
ajax.php
|
|
@ -560,7 +560,7 @@ if (isset($_POST['update_kanban_ticket'])) {
|
|||
|
||||
foreach ($positions as $position) {
|
||||
$ticket_id = intval($position['ticket_id']);
|
||||
$kanban = intval($position['ticket_kanban']); // ticket kanban position
|
||||
$kanban = intval($position['ticket_order']); // ticket kanban position
|
||||
$status = intval($position['ticket_status']); // ticket statuses
|
||||
$oldStatus = intval($position['ticket_oldStatus']); // ticket old status if moved
|
||||
|
||||
|
|
@ -575,20 +575,20 @@ if (isset($_POST['update_kanban_ticket'])) {
|
|||
|
||||
if ($oldStatus === false) {
|
||||
// if ticket was not moved, just uptdate the order on kanban
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_kanban = $kanban WHERE ticket_id = $ticket_id");
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban WHERE ticket_id = $ticket_id");
|
||||
customAction('ticket_update', $ticket_id);
|
||||
} else {
|
||||
// If the ticket was moved from a resolved status to another status, we need to update ticket_resolved_at
|
||||
if ($oldStatus === $statuses['Resolved']) {
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_kanban = $kanban, ticket_status = $status, ticket_resolved_at = NULL WHERE ticket_id = $ticket_id");
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban, ticket_status = $status, ticket_resolved_at = NULL WHERE ticket_id = $ticket_id");
|
||||
customAction('ticket_update', $ticket_id);
|
||||
} elseif ($status === $statuses['Resolved']) {
|
||||
// If the ticket was moved to a resolved status, we need to update ticket_resolved_at
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_kanban = $kanban, ticket_status = $status, ticket_resolved_at = NOW() WHERE ticket_id = $ticket_id");
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban, ticket_status = $status, ticket_resolved_at = NOW() WHERE ticket_id = $ticket_id");
|
||||
customAction('ticket_update', $ticket_id);
|
||||
} else {
|
||||
// If the ticket was moved from any status to another status
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_kanban = $kanban, ticket_status = $status WHERE ticket_id = $ticket_id");
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban, ticket_status = $status WHERE ticket_id = $ticket_id");
|
||||
customAction('ticket_update', $ticket_id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2474,7 +2474,7 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
|
||||
mysqli_query($mysqli, "ALTER TABLE `ticket_statuses` ADD `ticket_status_order` int(11) NOT NULL DEFAULT 0");
|
||||
|
||||
mysqli_query($mysqli, "ALTER TABLE `tickets` ADD `ticket_kanban` int(11) NOT NULL DEFAULT 0");
|
||||
mysqli_query($mysqli, "ALTER TABLE `tickets` ADD `ticket_order` int(11) NOT NULL DEFAULT 0");
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.1'");
|
||||
}
|
||||
|
|
|
|||
2
db.sql
2
db.sql
|
|
@ -2114,7 +2114,7 @@ CREATE TABLE `tickets` (
|
|||
`ticket_asset_id` int(11) NOT NULL DEFAULT 0,
|
||||
`ticket_invoice_id` int(11) NOT NULL DEFAULT 0,
|
||||
`ticket_project_id` int(11) NOT NULL DEFAULT 0,
|
||||
`ticket_kanban` int(11) NOT NULL DEFAULT 0,
|
||||
`ticket_order` int(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`ticket_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ $(document).ready(function() {
|
|||
}
|
||||
positions.push({
|
||||
ticket_id: ticketId,
|
||||
ticket_kanban: index,
|
||||
ticket_order: index,
|
||||
ticket_oldStatus: oldStatus,
|
||||
ticket_status: statusId ?? null// Get the new status ID from the target column
|
||||
});
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ $sql = mysqli_query(
|
|||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$id = $row['ticket_status_id'];
|
||||
$ticket_order = $row['ticket_kanban'];
|
||||
$ticket_order = $row['ticket_order'];
|
||||
$row['ticket_order'] = $ticket_order; // Store the ticket order
|
||||
|
||||
// Loop over all items in $row to apply nullable_htmlentities only if the content is a string
|
||||
|
|
@ -71,7 +71,7 @@ usort($kanban_array, function($a, $b) {
|
|||
return $a->order - $b->order;
|
||||
});
|
||||
|
||||
// Sort tickets within each column by 'ticket_kanban'
|
||||
// Sort tickets within each column by 'ticket_order'
|
||||
foreach ($kanban_array as $kanban_column) {
|
||||
usort($kanban_column->tickets, function($a, $b) {
|
||||
return $a['ticket_order'] - $b['ticket_order'];
|
||||
|
|
|
|||
Loading…
Reference in New Issue