Add Ticket Template order under project templates, this will state the execution order when deployed

This commit is contained in:
johnnyq 2024-04-05 18:20:09 -04:00
parent 60212b380c
commit b22781d2ea
5 changed files with 31 additions and 6 deletions

View File

@ -142,6 +142,7 @@ if (isset($_GET['project_template_id'])) {
while ($row = mysqli_fetch_array($sql_ticket_templates)) {
$ticket_template_id = intval($row['ticket_template_id']);
$ticket_template_order = intval($row['ticket_template_order']);
$ticket_template_name = nullable_htmlentities($row['ticket_template_name']);
$ticket_template_description = nullable_htmlentities($row['ticket_template_description']);
$ticket_template_subject = nullable_htmlentities($row['ticket_template_subject']);
@ -151,7 +152,13 @@ if (isset($_GET['project_template_id'])) {
?>
<tr>
<td>1</td>
<td class="pr-0">
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="edit_ticket_template_order" value="1">
<input type="hidden" name="ticket_template_id" value="<?php echo $ticket_template_id; ?>">
<input type="text" class="form-control pr-0" onchange="this.form.submit()" name="order" value="<?php echo $ticket_template_order; ?>">
</form>
</td>
<td>
<a href="admin_ticket_template_details.php?ticket_template_id=<?php echo $ticket_template_id; ?>">
<?php echo $ticket_template_name; ?>

View File

@ -1812,10 +1812,16 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.0'");
}
// if (CURRENT_DATABASE_VERSION == '1.2.0') {
// // Insert queries here required to update to DB version 1.2.1
if (CURRENT_DATABASE_VERSION == '1.2.0') {
mysqli_query($mysqli, "ALTER TABLE `ticket_templates` ADD `ticket_template_order` INT(11) NOT NULL DEFAULT 0 AFTER `ticket_template_details`");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.1'");
}
// if (CURRENT_DATABASE_VERSION == '1.2.1') {
// // Insert queries here required to update to DB version 1.2.2
// // Then, update the database to the next sequential version
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.1");
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.2.2");
// }
} else {

View File

@ -5,4 +5,4 @@
* It is used in conjunction with database_updates.php
*/
DEFINE("LATEST_DATABASE_VERSION", "1.2.0");
DEFINE("LATEST_DATABASE_VERSION", "1.2.1");

3
db.sql
View File

@ -1630,6 +1630,7 @@ CREATE TABLE `ticket_templates` (
`ticket_template_description` text DEFAULT NULL,
`ticket_template_subject` varchar(200) DEFAULT NULL,
`ticket_template_details` longtext DEFAULT NULL,
`ticket_template_order` int(11) NOT NULL DEFAULT 0,
`ticket_template_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`ticket_template_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
`ticket_template_archived_at` datetime DEFAULT NULL,
@ -1882,4 +1883,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-04-04 19:52:07
-- Dump completed on 2024-04-05 18:19:29

View File

@ -42,6 +42,17 @@ if (isset($_POST['edit_project_template'])) {
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
if (isset($_POST['edit_ticket_template_order'])) {
validateTechRole();
$ticket_template_id = intval($_POST['ticket_template_id']);
$order = intval($_POST['order']);
mysqli_query($mysqli, "UPDATE ticket_templates SET ticket_template_order = $order WHERE ticket_template_id = $ticket_template_id");
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
if (isset($_POST['add_ticket_template_to_project_template'])) {
validateTechRole();