mirror of https://github.com/itflow-org/itflow
Add functionality to delete service
This commit is contained in:
parent
d2da0545e1
commit
e509cc5719
|
|
@ -91,7 +91,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editServiceModal<?php//echo $service_id; ?>">Edit</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_service=<?php //echo $service_id; ?>">Delete</a>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_service=<?php echo $service_id; ?>">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
|||
21
post.php
21
post.php
|
|
@ -5539,10 +5539,31 @@ if(isset($_POST['add_service'])){
|
|||
$_SESSION['alert_message'] = "Something went wrong (SQL)";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_GET['delete_service'])){
|
||||
$service_id = intval($_GET['delete_service']);
|
||||
|
||||
// Delete service
|
||||
$delete_sql = mysqli_query($mysqli, "DELETE FROM services WHERE service_id = '$service_id' AND company_id = '$session_company_id'");
|
||||
|
||||
// Delete relations
|
||||
// TODO: Convert this to a join delete
|
||||
if($delete_sql){
|
||||
mysqli_query($mysqli, "DELETE FROM service_contacts WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_vendors WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_documents WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_assets WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_logins WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_domains WHERE service_id = '$service_id'");
|
||||
|
||||
$_SESSION['alert_message'] = "Service deleted";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
else{
|
||||
$_SESSION['alert_message'] = "Something went wrong (SQL)";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST['add_file'])){
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="modal-dialog modal-md">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i><?php echo $service_name; ?> </h5>
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue