Add backup note to services module

This commit is contained in:
Marcus Hill 2022-01-31 20:24:47 +00:00
parent a67fece250
commit 3bac0188e6
6 changed files with 29 additions and 4 deletions

View File

@ -58,6 +58,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$service_description = $row['service_description'];
$service_category = $row['service_category'];
$service_importance = $row['service_importance'];
$service_backup = $row['service_backup'];
$service_notes = $row['service_notes'];
$service_updated_at = $row['service_updated_at'];
$service_review_due = $row['service_review_due'];

1
db.sql
View File

@ -939,6 +939,7 @@ CREATE TABLE IF NOT EXISTS `services` (
`service_description` varchar(200) CHARACTER SET latin1 NOT NULL,
`service_category` varchar(20) CHARACTER SET latin1 NOT NULL,
`service_importance` varchar(10) CHARACTER SET latin1 NOT NULL,
`service_backup` varchar(200) CHARACTER SET latin1 DEFAULT NULL,
`service_notes` text CHARACTER SET latin1 NOT NULL,
`service_created_at` datetime NOT NULL,
`service_updated_at` datetime DEFAULT NULL,

View File

@ -5582,10 +5582,11 @@ if(isset($_POST['add_service'])){
$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_backup = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['backup'])));
$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'");
$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_backup = '$service_backup', service_notes = '$service_notes', service_created_at = NOW(), service_client_id = '$client_id', company_id = '$session_company_id'");
// TODO: Support for URLs
@ -5667,10 +5668,11 @@ if(isset($_POST['edit_service'])){
$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_backup = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['backup'])));
$service_notes = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['note'])));
// Update main service details
mysqli_query($mysqli, "UPDATE services SET service_name = '$service_name', service_description = '$service_description', service_category = '$service_category', service_importance = '$service_importance', service_notes = '$service_notes', service_updated_at = NOW() WHERE service_id = '$service_id' AND company_id = '$session_company_id'");
mysqli_query($mysqli, "UPDATE services SET service_name = '$service_name', service_description = '$service_description', service_category = '$service_category', service_importance = '$service_importance', service_backup = '$service_backup', service_notes = '$service_notes', service_updated_at = NOW() WHERE service_id = '$service_id' AND company_id = '$session_company_id'");
// Unlink existing relations/assets
mysqli_query($mysqli, "DELETE FROM service_contacts WHERE service_id = '$service_id'");

View File

@ -78,6 +78,16 @@
</div>
</div>
<div class="form-group">
<label>Backup</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-hdd"></i></span>
</div>
<input type="text" class="form-control" name="backup" placeholder="Backup strategy" autofocus>
</div>
</div>
<!-- TODO: We need a way of adding multiple (optional) URLs? Ideas? -->
<!-- <div class="form-group">
<label>URL</label>

View File

@ -79,6 +79,16 @@
</div>
</div>
<div class="form-group">
<label>Backup</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-hdd"></i></span>
</div>
<input type="text" class="form-control" name="backup" placeholder="Backup strategy" value="<?php echo $service_backup ?>" autofocus>
</div>
</div>
<!-- TODO: We need a way of adding multiple (optional) URLs? Ideas? -->
<!-- <div class="form-group">
<label>URL</label>

View File

@ -14,8 +14,9 @@
<div class="col-8 border-right">
<div class="col-12">
<h4>Service Overview: <?php echo $service_name; ?></h4>
<p>Service Importance: <?php echo $service_importance_display; ?>
<p><?php echo $service_description; ?></p>
<b>Importance:</b> <?php echo $service_importance_display; ?> <br>
<b>Description:</b> <?php echo $service_description; ?> <br>
<b>Backup Info:</b> <?php echo $service_backup; ?> <br><br>
<h5><i class="nav-icon fas fa-sticky-note"></i> Notes</h5>
<p><?php echo $service_notes; ?></p>