mirror of https://github.com/itflow-org/itflow
Add service logic. Removing URLs for now
This commit is contained in:
parent
58603e7550
commit
301e6d94cd
|
|
@ -77,7 +77,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php
|
||||
|
||||
// Associated Assets (and their logins/networks)
|
||||
// Associated Assets (and their logins/networks/locations)
|
||||
$sql_assets = mysqli_query($mysqli, "SELECT * FROM service_assets
|
||||
LEFT JOIN assets
|
||||
ON service_assets.asset_id = assets.asset_id
|
||||
|
|
|
|||
73
post.php
73
post.php
|
|
@ -5470,6 +5470,79 @@ if(isset($_GET['export_client_tickets_csv'])){
|
|||
}
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_service'])){
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$service_name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$service_description = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['description'])));
|
||||
$service_category = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['category']))); //TODO: Needs integration with company categories
|
||||
$service_importance = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['importance'])));
|
||||
$service_notes = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['note'])));
|
||||
|
||||
// Create Service
|
||||
$service_sql = mysqli_query($mysqli, "INSERT INTO services SET service_name = '$service_name', service_description = '$service_description', service_category = '$service_category', service_importance = '$service_importance', service_notes = '$service_notes', service_created_at = NOW(), service_client_id = '$client_id', company_id = '$session_company_id'");
|
||||
|
||||
// TODO: Support for URLs
|
||||
|
||||
// Create links to assets
|
||||
if($service_sql){
|
||||
$service_id = $mysqli->insert_id;
|
||||
|
||||
$service_contact_ids = $_POST['contacts'];
|
||||
foreach($service_contact_ids as $contact_id){
|
||||
if(intval($contact_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_contacts SET service_id = '$service_id', contact_id = '$contact_id'");
|
||||
}
|
||||
}
|
||||
|
||||
$service_vendor_ids = $_POST['vendors'];
|
||||
foreach($service_vendor_ids as $vendor_id){
|
||||
if(intval($vendor_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_vendors SET service_id = '$service_id', vendor_id = '$vendor_id'");
|
||||
}
|
||||
}
|
||||
|
||||
$service_document_ids = $_POST['documents'];
|
||||
foreach($service_document_ids as $document_id){
|
||||
if(intval($document_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_documents SET service_id = '$service_id', document_id = '$document_id'");
|
||||
}
|
||||
}
|
||||
|
||||
$service_asset_ids = $_POST['assets'];
|
||||
foreach($service_asset_ids as $asset_id){
|
||||
if(intval($asset_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_assets SET service_id = '$service_id', asset_id = '$asset_id'");
|
||||
}
|
||||
}
|
||||
|
||||
$service_login_ids = $_POST['logins'];
|
||||
foreach($service_login_ids as $login_id){
|
||||
if(intval($login_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_logins SET service_id = '$service_id', login_id = '$login_id'");
|
||||
}
|
||||
}
|
||||
|
||||
$service_domain_ids = $_POST['domains'];
|
||||
foreach($service_domain_ids as $domain_id){
|
||||
if(intval($domain_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_domains SET service_id = '$service_id', domain_id = '$domain_id'");
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['alert_message'] = "Service added";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
else{
|
||||
$_SESSION['alert_message'] = "Something went wrong (SQL)";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_file'])){
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-info"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Category" autofocus>
|
||||
<input type="text" class="form-control" name="category" placeholder="Category" autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
</div>
|
||||
|
||||
<!-- TODO: We need a way of adding multiple (optional) URLs? Ideas? -->
|
||||
<div class="form-group">
|
||||
<!-- <div class="form-group">
|
||||
<label>URL</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
</div>
|
||||
<input type="text" class="form-control" name="url" placeholder="URL" autofocus>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
|
|
|
|||
Loading…
Reference in New Issue