Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tickets views #1158

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
16 changes: 13 additions & 3 deletions database_updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -2469,10 +2469,20 @@ function processFile($file_path, $file_name, $mysqli) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.0'");
}

// if (CURRENT_DATABASE_VERSION == '1.8.0') {
// // Insert queries here required to update to DB version 1.8.1
if (CURRENT_DATABASE_VERSION == '1.8.0') {


mysqli_query($mysqli, "ALTER TABLE `ticket_statuses` ADD `ticket_status_kanban` int(11)");

mysqli_query($mysqli, "ALTER TABLE `tickets` ADD `ticket_kanban` int(11);");

mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.1'");
}

// if (CURRENT_DATABASE_VERSION == '1.8.1') {
// // Insert queries here required to update to DB version 1.8.2
// // Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.1'");
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.8.2'");
// }

} else {
Expand Down
2 changes: 2 additions & 0 deletions db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,7 @@ CREATE TABLE `ticket_statuses` (
`ticket_status_name` varchar(200) NOT NULL,
`ticket_status_color` varchar(200) NOT NULL,
`ticket_status_active` tinyint(1) NOT NULL DEFAULT 1,
`ticket_status_kanban` int(11),
PRIMARY KEY (`ticket_status_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
Expand Down Expand Up @@ -2113,6 +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),
PRIMARY KEY (`ticket_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
Expand Down
2 changes: 1 addition & 1 deletion includes/database_version.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* It is used in conjunction with database_updates.php
*/

DEFINE("LATEST_DATABASE_VERSION", "1.8.0");
DEFINE("LATEST_DATABASE_VERSION", "1.8.1");
50 changes: 50 additions & 0 deletions post/user/ticket_kanban.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

/*
* ITFlow - GET/POST request handler for client tickets
*/

defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");

if (isset($_POST['update_kanban_status_position'])) {
ssteeltm marked this conversation as resolved.
Show resolved Hide resolved
// Update multiple ticket status kanban orders
enforceUserPermission('module_support', 2);

$positions = $_POST['positions'];

foreach ($positions as $position) {
$status_id = intval($position['status_id']);
$kanban = intval($position['status_kanban']);

mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_kanban = $kanban WHERE ticket_status_id = $status_id");
}

// return a response
echo json_encode(['status' => 'success']);
exit;
}

if (isset($_POST['update_kanban_ticket'])) {
// Update ticket kanban order and status
enforceUserPermission('module_support', 2);

$positions = $_POST['positions'];

foreach ($positions as $position) {
$ticket_id = intval($position['ticket_id']);
$kanban = intval($position['ticket_kanban']); // ticket kanban position
$status = intval($position['ticket_status']); // ticket statuses

// Continue if status is null
if ($status === null) {
continue;
}

mysqli_query($mysqli, "UPDATE tickets SET ticket_kanban = $kanban, ticket_status = $status WHERE ticket_id = $ticket_id");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved tickets should be setting ticket_resolved_at, and un-resolving a ticket should unset it.

If $config_ticket_client_general_notifications is enabled, we should be sending the contact & any watchers an email to say it's resolved.

Copy link
Contributor Author

@ssteeltm ssteeltm Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Resolved tickets should be setting ticket_resolved_at, and un-resolving a ticket should unset it.
  • If $config_ticket_client_general_notifications is enabled, we should be sending the contact & any watchers an email to say it's resolved.

Copy link
Contributor Author

@ssteeltm ssteeltm Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you sugest to have the notifications? As I see theres no function to do so, its all coded in ticket posts. The way I see now is to duplicate codes in ajax.php

customAction('ticket_update', $ticket_id);
}

// return a response
echo json_encode(['status' => 'success','payload' => $positions]);
exit;
}
361 changes: 73 additions & 288 deletions tickets.php

Large diffs are not rendered by default.

280 changes: 280 additions & 0 deletions tickets_compact.php

Large diffs are not rendered by default.

Loading