mirror of
https://github.com/itflow-org/itflow
synced 2026-09-23 07:01:16 +00:00
Bug: Fix not being able to unarchive software
This commit is contained in:
@@ -200,6 +200,32 @@ if (isset($_GET['archive_software'])) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($_GET['restore_software'])){
|
||||||
|
|
||||||
|
validateCSRFToken();
|
||||||
|
|
||||||
|
enforceUserPermission('module_support', 2);
|
||||||
|
|
||||||
|
$software_id = intval($_GET['restore_software']);
|
||||||
|
|
||||||
|
// Get Software Name and Client ID for logging and alert message
|
||||||
|
$sql = mysqli_query($mysqli,"SELECT software_name, software_client_id FROM software WHERE software_id = $software_id");
|
||||||
|
$row = mysqli_fetch_assoc($sql);
|
||||||
|
$software_name = escapeSql($row['software_name']);
|
||||||
|
$client_id = intval($row['software_client_id']);
|
||||||
|
|
||||||
|
enforceClientAccess();
|
||||||
|
|
||||||
|
mysqli_query($mysqli,"UPDATE software SET software_archived_at = NULL WHERE software_id = $software_id");
|
||||||
|
|
||||||
|
logAudit("Software", "Restore", "$session_name restored software $software_name", $client_id, $software_id);
|
||||||
|
|
||||||
|
flashAlert("Software <strong>$software_name</strong> restored");
|
||||||
|
|
||||||
|
redirect();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET['delete_software'])) {
|
if (isset($_GET['delete_software'])) {
|
||||||
|
|
||||||
validateCSRFToken();
|
validateCSRFToken();
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ $sql = mysqli_query(
|
|||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT SQL_CALC_FOUND_ROWS client_id, client_name, software_created_at, software_description, software_expire,
|
"SELECT SQL_CALC_FOUND_ROWS client_id, client_name, software_created_at, software_description, software_expire,
|
||||||
software_id, software_license_type, software_name, software_seats, software_type,
|
software_id, software_license_type, software_name, software_seats, software_type,
|
||||||
software_version, vendor_id, vendor_name FROM software
|
software_version, software_archived_at, vendor_id, vendor_name FROM software
|
||||||
LEFT JOIN clients ON client_id = software_client_id
|
LEFT JOIN clients ON client_id = software_client_id
|
||||||
LEFT JOIN vendors ON vendor_id = software_vendor_id
|
LEFT JOIN vendors ON vendor_id = software_vendor_id
|
||||||
WHERE (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%' OR client_name LIKE '%$q%')
|
WHERE (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%' OR client_name LIKE '%$q%')
|
||||||
@@ -236,6 +236,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$software_license_type = escapeHtml($row['software_license_type']) ?: '-';
|
$software_license_type = escapeHtml($row['software_license_type']) ?: '-';
|
||||||
$software_seats = escapeHtml($row['software_seats']);
|
$software_seats = escapeHtml($row['software_seats']);
|
||||||
$software_expire = escapeHtml($row['software_expire']);
|
$software_expire = escapeHtml($row['software_expire']);
|
||||||
|
$software_archived_at = escapeHtml($row['software_archived_at']);
|
||||||
$vendor_name = escapeHtml($row['vendor_name']);
|
$vendor_name = escapeHtml($row['vendor_name']);
|
||||||
$vendor_id = intval($row['vendor_id']);
|
$vendor_id = intval($row['vendor_id']);
|
||||||
if ($vendor_name) {
|
if ($vendor_name) {
|
||||||
@@ -321,13 +322,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<i class="fas fa-ellipsis-h"></i>
|
<i class="fas fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/software/software_edit.php?id=<?= $software_id ?>"
|
<?php if (!$software_archived_at) { ?>
|
||||||
>
|
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/software/software_edit.php?id=<?= $software_id ?>">
|
||||||
<i class="fas fa-fw fa-edit me-2"></i>Edit
|
<i class="fas fa-fw fa-edit me-2"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_software=<?= $software_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_software=<?= $software_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||||
<i class="fas fa-fw fa-archive me-2"></i>Archive and<br><small>Remove Licenses</small></a>
|
<i class="fas fa-fw fa-archive me-2"></i>Archive and<br><small>Remove Licenses</small>
|
||||||
|
</a>
|
||||||
|
<?php } else { ?>
|
||||||
|
<a class="dropdown-item text-info confirm-link" href="post.php?restore_software=<?= $software_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||||
|
<i class="fas fa-fw fa-redo me-2"></i>Restore
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
<?php if ($session_user_role == 3) { ?>
|
<?php if ($session_user_role == 3) { ?>
|
||||||
<?php if ($config_destructive_deletes_enable) { ?>
|
<?php if ($config_destructive_deletes_enable) { ?>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user