mirror of https://github.com/itflow-org/itflow
Now you can mark a project complete when all Tickets for the project are closed and we now show an open or closed status by the project name
This commit is contained in:
parent
064b37f87e
commit
43c06b8151
|
|
@ -45,6 +45,27 @@ if (isset($_POST['edit_project'])) {
|
|||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_GET['complete_project'])) {
|
||||
|
||||
validateTechRole();
|
||||
|
||||
$project_id = intval($_GET['complete_project']);
|
||||
|
||||
// Get Project Name and client id for logging
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM projects WHERE project_id = $project_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$client_id = intval($row['project_client_id']);
|
||||
$project_name = sanitizeInput($row['project_name']);
|
||||
|
||||
mysqli_query($mysqli, "UPDATE projects SET project_completed_at = NOW() WHERE project_id = $project_id");
|
||||
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Project', log_action = 'Complete', log_description = '$session_name marked project $project_name completed', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $project_id");
|
||||
|
||||
$_SESSION['alert_message'] = "You marked Project <strong>$project_name</strong> as completed";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_GET['delete_project'])) {
|
||||
|
||||
|
|
|
|||
|
|
@ -26,12 +26,19 @@ if (isset($_GET['project_id'])) {
|
|||
$project_name = nullable_htmlentities($row['project_name']);
|
||||
$project_description = nullable_htmlentities($row['project_description']);
|
||||
$project_due = nullable_htmlentities($row['project_due']);
|
||||
$project_completed_at = nullable_htmlentities($row['project_completed_at']);
|
||||
$project_created_at = date("Y-m-d", strtotime($row['project_created_at']));
|
||||
$project_updated_at = nullable_htmlentities($row['project_updated_at']);
|
||||
|
||||
$client_id = intval($row['client_id']);
|
||||
$client_name = nullable_htmlentities($row['client_name']);
|
||||
|
||||
if($project_completed_at) {
|
||||
$project_status_display = "<span class='badge badge-pill badge-dark ml-2'>Complete</span>";
|
||||
} else {
|
||||
$project_status_display = "<span class='badge badge-pill badge-primary ml-2'>Open</span>";
|
||||
}
|
||||
|
||||
// Get Tickets
|
||||
$sql_tickets = mysqli_query($mysqli, "SELECT * FROM tickets
|
||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||
|
|
@ -88,7 +95,7 @@ if (isset($_GET['project_id'])) {
|
|||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-project-diagram text-secondary mr-3"></i>
|
||||
<div class="media-body">
|
||||
<h3 class="mb-0"><?php echo $project_name; ?></h3>
|
||||
<h3 class="mb-0"><?php echo $project_name; ?><?php echo $project_status_display; ?></h3>
|
||||
<div><small class="text-secondary"><?php echo $project_description; ?></small></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -120,6 +127,11 @@ if (isset($_GET['project_id'])) {
|
|||
|
||||
<div class="col-sm-3">
|
||||
<div class="btn-group float-right d-print-none">
|
||||
<?php if($tickets_closed_percent == 100 && empty($project_completed_at)) { ?>
|
||||
<a class="btn btn-primary btn-sm confirm-link" href="post.php?complete_project=<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-check mr-2"></i>Complete
|
||||
</a>
|
||||
<?php } ?>
|
||||
<div class="dropdown dropleft text-center ml-3">
|
||||
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown">
|
||||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||
|
|
|
|||
Loading…
Reference in New Issue