mirror of
https://github.com/itflow-org/itflow
synced 2026-08-24 00:15:12 +00:00
Assets: Moved asset status to be creatable/editable Categories with common defaults and descriptions also Add category description to add / edit modals and description underneath category name
This commit is contained in:
@@ -89,6 +89,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
} else {
|
} else {
|
||||||
echo 'btn-default';
|
echo 'btn-default';
|
||||||
} ?>">Network Interface</a>
|
} ?>">Network Interface</a>
|
||||||
|
<a href="?category=asset_status"
|
||||||
|
class="btn <?php if ($category == 'asset_status') {
|
||||||
|
echo 'btn-primary';
|
||||||
|
} else {
|
||||||
|
echo 'btn-default';
|
||||||
|
} ?>">Asset Status</a>
|
||||||
<a href="?<?php echo $url_query_strings_sort ?>&archived=1"
|
<a href="?<?php echo $url_query_strings_sort ?>&archived=1"
|
||||||
class="btn <?php if (isset($_GET['archived'])) {
|
class="btn <?php if (isset($_GET['archived'])) {
|
||||||
echo 'btn-primary';
|
echo 'btn-primary';
|
||||||
@@ -120,6 +126,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
while ($row = mysqli_fetch_assoc($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$category_id = intval($row['category_id']);
|
$category_id = intval($row['category_id']);
|
||||||
$category_name = nullable_htmlentities($row['category_name']);
|
$category_name = nullable_htmlentities($row['category_name']);
|
||||||
|
$category_description = nullable_htmlentities($row['category_description']);
|
||||||
$category_color = nullable_htmlentities($row['category_color']);
|
$category_color = nullable_htmlentities($row['category_color']);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -128,6 +135,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<a class="text-dark ajax-modal" href="#"
|
<a class="text-dark ajax-modal" href="#"
|
||||||
data-modal-url="modals/category/category_edit.php?id=<?= $category_id ?>">
|
data-modal-url="modals/category/category_edit.php?id=<?= $category_id ?>">
|
||||||
<?php echo $category_name; ?>
|
<?php echo $category_name; ?>
|
||||||
|
<div><small class="text-secondary"><?= $category_description ?></small></div>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td><i class="fa fa-3x fa-circle" style="color:<?php echo $category_color; ?>;"></i></td>
|
<td><i class="fa fa-3x fa-circle" style="color:<?php echo $category_color; ?>;"></i></td>
|
||||||
|
|||||||
@@ -4350,13 +4350,25 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Fiber', category_type = 'network_interface', category_order = 7"); // 7
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Fiber', category_type = 'network_interface', category_order = 7"); // 7
|
||||||
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'WiFi', category_type = 'network_interface', category_order = 8"); // 8
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'WiFi', category_type = 'network_interface', category_order = 8"); // 8
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.4.3'");
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.4.3'");
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// // if (CURRENT_DATABASE_VERSION == '2.4.3') {
|
if (CURRENT_DATABASE_VERSION == '2.4.3') {
|
||||||
// // Insert queries here required to update to DB version 2.4.4
|
// Asset Status
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Ready to Deploy', category_description = 'Asset is configured and ready to be assigned', category_type = 'asset_status', category_order = 1"); // 1
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Deployed', category_description = 'Asset is actively in use and assigned to a client or location', category_type = 'asset_status', category_order = 2"); // 2
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Out for Repair', category_description = 'Asset has been sent out for servicing or repair', category_type = 'asset_status', category_order = 3"); // 3
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Lost', category_description = 'Asset location is unknown and cannot be accounted for', category_type = 'asset_status', category_order = 4"); // 4
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Stolen', category_description = 'Asset has been reported stolen', category_type = 'asset_status', category_order = 5"); // 5
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Retired', category_description = 'Asset has been decommissioned and is no longer in service', category_type = 'asset_status', category_order = 6"); // 6
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (CURRENT_DATABASE_VERSION == '2.4.4') {
|
||||||
|
// // Insert queries here required to update to DB version 2.4.5
|
||||||
// // Then, update the database to the next sequential version
|
// // Then, update the database to the next sequential version
|
||||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.4.4'");
|
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.4.5'");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -60,6 +60,16 @@ $category_types_array = ['Expense', 'Income', 'Referral', 'Ticket'];
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fas fa-fw fa-align-left"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Enter a description" maxlength="200">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="add_category" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create Category</button>
|
<button type="submit" name="add_category" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create Category</button>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_id = $cate
|
|||||||
|
|
||||||
$row = mysqli_fetch_assoc($sql);
|
$row = mysqli_fetch_assoc($sql);
|
||||||
$category_name = nullable_htmlentities($row['category_name']);
|
$category_name = nullable_htmlentities($row['category_name']);
|
||||||
|
$category_description = nullable_htmlentities($row['category_description']);
|
||||||
$category_color = nullable_htmlentities($row['category_color']);
|
$category_color = nullable_htmlentities($row['category_color']);
|
||||||
$category_type = nullable_htmlentities($row['category_type']);
|
$category_type = nullable_htmlentities($row['category_type']);
|
||||||
|
|
||||||
@@ -46,6 +47,16 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Description</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fas fa-fw fa-align-left"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="description" placeholder="Enter a description" maxlength="200" value="<?= $category_description ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="edit_category" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
<button type="submit" name="edit_category" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ if (isset($_POST['add_category'])) {
|
|||||||
|
|
||||||
require_once 'category_model.php';
|
require_once 'category_model.php';
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO categories SET category_name = '$name', category_type = '$type', category_color = '$color'");
|
mysqli_query($mysqli,"INSERT INTO categories SET category_name = '$name', category_description = '$description', category_type = '$type', category_color = '$color'");
|
||||||
|
|
||||||
$category_id = mysqli_insert_id($mysqli);
|
$category_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ if (isset($_POST['edit_category'])) {
|
|||||||
|
|
||||||
$category_id = intval($_POST['category_id']);
|
$category_id = intval($_POST['category_id']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE categories SET category_name = '$name', category_type = '$type', category_color = '$color' WHERE category_id = $category_id");
|
mysqli_query($mysqli,"UPDATE categories SET category_name = '$name', category_description = '$description', category_type = '$type', category_color = '$color' WHERE category_id = $category_id");
|
||||||
|
|
||||||
logAction("Category", "Edit", "$session_name edited category $type $name", 0, $category_id);
|
logAction("Category", "Edit", "$session_name edited category $type $name", 0, $category_id);
|
||||||
|
|
||||||
|
|||||||
@@ -2,5 +2,6 @@
|
|||||||
defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
|
defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
|
||||||
|
|
||||||
$name = sanitizeInput($_POST['name']);
|
$name = sanitizeInput($_POST['name']);
|
||||||
|
$description = sanitizeInput($_POST['description']);
|
||||||
$type = sanitizeInput($_POST['type']);
|
$type = sanitizeInput($_POST['type']);
|
||||||
$color = sanitizeInput($_POST['color']);
|
$color = sanitizeInput($_POST['color']);
|
||||||
|
|||||||
@@ -258,8 +258,17 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" name="status">
|
<select class="form-control select2" name="status">
|
||||||
<option value="">- Select Status -</option>
|
<option value="">- Select Status -</option>
|
||||||
<?php foreach($asset_status_array as $asset_status) { ?>
|
<?php
|
||||||
<option><?php echo $asset_status; ?></option>
|
$sql_interface_types_select = mysqli_query($mysqli, "
|
||||||
|
SELECT category_name FROM categories
|
||||||
|
WHERE category_type = 'asset_status'
|
||||||
|
AND category_archived_at IS NULL
|
||||||
|
ORDER BY category_order ASC, category_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql_interface_types_select)) {
|
||||||
|
$asset_status_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option><?= $asset_status_select ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,12 +26,21 @@ ob_start();
|
|||||||
<label>Status</label>
|
<label>Status</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-info"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-circle"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" name="bulk_status">
|
<select class="form-control select2" name="bulk_status">
|
||||||
<option value="">- Status -</option>
|
<option value="">- Select Status -</option>
|
||||||
<?php foreach($asset_status_array as $asset_status) { ?>
|
<?php
|
||||||
<option><?php echo $asset_status; ?></option>
|
$sql_interface_types_select = mysqli_query($mysqli, "
|
||||||
|
SELECT category_name FROM categories
|
||||||
|
WHERE category_type = 'asset_status'
|
||||||
|
AND category_archived_at IS NULL
|
||||||
|
ORDER BY category_order ASC, category_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql_interface_types_select)) {
|
||||||
|
$asset_status_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option><?= $asset_status_select ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -228,8 +228,20 @@ ob_start();
|
|||||||
<span class="input-group-text"><i class="fa fa-fw fa-circle"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-circle"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" name="status">
|
<select class="form-control select2" name="status">
|
||||||
<?php foreach($asset_status_array as $asset_status_select) { ?>
|
<option value="">- Select Status -</option>
|
||||||
<option <?php if ($asset_status_select == $asset_status) { echo "selected"; } ?>><?php echo $asset_status_select; ?></option>
|
<?php
|
||||||
|
$sql_interface_types_select = mysqli_query($mysqli, "
|
||||||
|
SELECT category_name FROM categories
|
||||||
|
WHERE category_type = 'asset_status'
|
||||||
|
AND category_archived_at IS NULL
|
||||||
|
ORDER BY category_order ASC, category_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql_interface_types_select)) {
|
||||||
|
$asset_status_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($asset_status_select == $asset_status) { echo "selected"; } ?>>
|
||||||
|
<?= $asset_status_select ?>
|
||||||
|
</option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -270,8 +270,20 @@ ob_start();
|
|||||||
<span class="input-group-text"><i class="fa fa-fw fa-circle"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-circle"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" name="status">
|
<select class="form-control select2" name="status">
|
||||||
<?php foreach($asset_status_array as $asset_status_select) { ?>
|
<option value="">- Select Status -</option>
|
||||||
<option <?php if ($asset_status_select == $asset_status) { echo "selected"; } ?>><?= $asset_status_select ?></option>
|
<?php
|
||||||
|
$sql_interface_types_select = mysqli_query($mysqli, "
|
||||||
|
SELECT category_name FROM categories
|
||||||
|
WHERE category_type = 'asset_status'
|
||||||
|
AND category_archived_at IS NULL
|
||||||
|
ORDER BY category_order ASC, category_name ASC
|
||||||
|
");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql_interface_types_select)) {
|
||||||
|
$asset_status_select = nullable_htmlentities($row['category_name']);
|
||||||
|
?>
|
||||||
|
<option <?php if ($asset_status_select == $asset_status) { echo "selected"; } ?>>
|
||||||
|
<?= $asset_status_select ?>
|
||||||
|
</option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,4 +5,4 @@
|
|||||||
* It is used in conjunction with database_updates.php
|
* It is used in conjunction with database_updates.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEFINE("LATEST_DATABASE_VERSION", "2.4.3");
|
DEFINE("LATEST_DATABASE_VERSION", "2.4.4");
|
||||||
|
|||||||
@@ -243,15 +243,6 @@ $document_types_array = array (
|
|||||||
'2'=>'Global Template'
|
'2'=>'Global Template'
|
||||||
);
|
);
|
||||||
|
|
||||||
$asset_status_array = array (
|
|
||||||
'Ready to Deploy',
|
|
||||||
'Deployed',
|
|
||||||
'Out for Repair',
|
|
||||||
'Lost',
|
|
||||||
'Stolen',
|
|
||||||
'Retired'
|
|
||||||
);
|
|
||||||
|
|
||||||
$ticket_status_array = array (
|
$ticket_status_array = array (
|
||||||
'Open',
|
'Open',
|
||||||
'On Hold',
|
'On Hold',
|
||||||
|
|||||||
@@ -593,6 +593,14 @@ if (isset($_POST['add_company_settings'])) {
|
|||||||
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Fiber', category_type = 'network_interface', category_order = 7"); // 7
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Fiber', category_type = 'network_interface', category_order = 7"); // 7
|
||||||
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'WiFi', category_type = 'network_interface', category_order = 8"); // 8
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'WiFi', category_type = 'network_interface', category_order = 8"); // 8
|
||||||
|
|
||||||
|
// Asset statuses
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Ready to Deploy', category_description = 'Asset is configured and ready to be assigned', category_type = 'asset_status', category_order = 1"); // 1
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Deployed', category_description = 'Asset is actively in use and assigned to a client or location', category_type = 'asset_status', category_order = 2"); // 2
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Out for Repair', category_description = 'Asset has been sent out for servicing or repair', category_type = 'asset_status', category_order = 3"); // 3
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Lost', category_description = 'Asset location is unknown and cannot be accounted for', category_type = 'asset_status', category_order = 4"); // 4
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Stolen', category_description = 'Asset has been reported stolen', category_type = 'asset_status', category_order = 5"); // 5
|
||||||
|
mysqli_query($mysqli, "INSERT INTO categories SET category_name = 'Retired', category_description = 'Asset has been decommissioned and is no longer in service', category_type = 'asset_status', category_order = 6"); // 6
|
||||||
|
|
||||||
|
|
||||||
$_SESSION['alert_message'] = "Company <strong>$name</strong> created";
|
$_SESSION['alert_message'] = "Company <strong>$name</strong> created";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user