mirror of https://github.com/itflow-org/itflow
Feature Ability to Edit Task names under Ticket Templates
This commit is contained in:
parent
9f73b13dcf
commit
1076ffb5f7
|
|
@ -95,20 +95,26 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
|
|||
<table class="table table-striped table-sm">
|
||||
<?php
|
||||
while($row = mysqli_fetch_array($sql_task_templates)){
|
||||
$task_template_id = intval($row['task_template_id']);
|
||||
$task_template_name = nullable_htmlentities($row['task_template_name']);
|
||||
$task_template_description = nullable_htmlentities($row['task_template_description']);
|
||||
$task_id = intval($row['task_template_id']);
|
||||
$task_name = nullable_htmlentities($row['task_template_name']);
|
||||
$task_description = nullable_htmlentities($row['task_template_description']);
|
||||
?>
|
||||
<tr>
|
||||
<td><i class="far fa-fw fa-square text-secondary"></i></td>
|
||||
<td><?php echo $task_template_name; ?></td>
|
||||
<td><?php echo $task_name; ?></td>
|
||||
<td class="text-right">
|
||||
<a href="post.php?delete_task_template=<?php echo $task_template_id; ?>" class="btn btn-link btn-sm text-secondary">
|
||||
<button type="button" class="btn btn-link btn-sm text-secondary" data-toggle="modal" data-target="#editTaskModal<?php echo $task_id; ?>">
|
||||
<i class="fa fa-fw fa-pencil-alt"></i>
|
||||
</button>
|
||||
<a href="post.php?delete_task_template=<?php echo $task_id; ?>" class="btn btn-link btn-sm text-danger">
|
||||
<i class="fa fa-fw fa-trash-alt"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php
|
||||
require "task_edit_modal.php";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -34,13 +34,20 @@ if (isset($_POST['edit_task'])) {
|
|||
|
||||
$task_id = intval($_POST['task_id']);
|
||||
$task_name = sanitizeInput($_POST['name']);
|
||||
$is_ticket = intval($_POST['is_ticket']);
|
||||
|
||||
// Get Client ID
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM tasks LEFT JOIN tickets ON ticket_id = task_ticket_id WHERE task_id = $task_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$client_id = intval($row['ticket_client_id']);
|
||||
if($is_ticket == 1) {
|
||||
// Get Client ID
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM tasks LEFT JOIN tickets ON ticket_id = task_ticket_id WHERE task_id = $task_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$client_id = intval($row['ticket_client_id']);
|
||||
mysqli_query($mysqli, "UPDATE tasks SET task_name = '$task_name' WHERE task_id = $task_id");
|
||||
} else {
|
||||
$client_id = 0;
|
||||
mysqli_query($mysqli, "UPDATE task_templates SET task_template_name = '$task_name' WHERE task_template_id = $task_id");
|
||||
}
|
||||
|
||||
mysqli_query($mysqli, "UPDATE tasks SET task_name = '$task_name' WHERE task_id = $task_id");
|
||||
|
||||
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Task', log_action = 'Edit', log_description = '$session_name edited task $task_name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $task_id");
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="task_id" value="<?php echo $task_id; ?>">
|
||||
<!-- Check to see if its a ticket template task or ticket task by checking to see if ticket_id is set -->
|
||||
<input type="hidden" name="is_ticket" value="<?php if ($ticket_id) { echo 1; } else { echo 0; } ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
|||
Loading…
Reference in New Issue