mirror of
https://github.com/itflow-org/itflow
synced 2026-07-23 08:50:42 +00:00
Add Expiring in Filter Field to assets, licenses, domains and certificate and wire that into the dashboard as well
This commit is contained in:
@@ -34,6 +34,21 @@ if (isset($_GET['client_id'])) {
|
||||
// Perms
|
||||
enforceUserPermission('module_support');
|
||||
|
||||
// Expiring In Filter
|
||||
if (isset($_GET['expire_days']) && !empty($_GET['expire_days'])) {
|
||||
if ($_GET['expire_days'] == "expired") {
|
||||
$expire_days = "expired";
|
||||
$expire_query = "AND (certificate_expire IS NOT NULL AND certificate_expire != '0000-00-00' AND certificate_expire < CURDATE())";
|
||||
} else {
|
||||
$expire_days = intval($_GET['expire_days']);
|
||||
$expire_query = "AND (certificate_expire IS NOT NULL AND certificate_expire != '0000-00-00' AND certificate_expire BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL $expire_days DAY))";
|
||||
}
|
||||
} else {
|
||||
// Default - any
|
||||
$expire_days = '';
|
||||
$expire_query = '';
|
||||
}
|
||||
|
||||
if (!$client_url) {
|
||||
// Client Filter
|
||||
if (isset($_GET['client']) & !empty($_GET['client'])) {
|
||||
@@ -52,6 +67,7 @@ $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM certificates
|
||||
AND (certificate_name LIKE '%$q%' OR certificate_domain LIKE '%$q%' OR certificate_description LIKE '%$q%' OR certificate_issued_by LIKE '%$q%' OR client_name LIKE '%$q%')
|
||||
$access_permission_query
|
||||
$client_query
|
||||
$expire_query
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
@@ -94,9 +110,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($client_url) { ?>
|
||||
<div class="col-md-2"></div>
|
||||
<?php } else { ?>
|
||||
<?php if (!$client_url) { ?>
|
||||
<div class="col-md-2">
|
||||
<div class="input-group">
|
||||
<select class="form-control select2" name="client" onchange="this.form.submit()">
|
||||
@@ -125,7 +139,25 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-2">
|
||||
<div class="input-group mb-3 mb-md-0">
|
||||
<select class="form-control select2" name="expire_days" onchange="this.form.submit()">
|
||||
<option value="" <?php if ($expire_days == "") { echo "selected"; } ?>>- Expiring In -</option>
|
||||
<option value="expired" <?php if ($expire_days === "expired") { echo "selected"; } ?>>Expired</option>
|
||||
<option value="7" <?php if ($expire_days === 7) { echo "selected"; } ?>>7 Days</option>
|
||||
<option value="30" <?php if ($expire_days === 30) { echo "selected"; } ?>>30 Days</option>
|
||||
<option value="45" <?php if ($expire_days === 45) { echo "selected"; } ?>>45 Days</option>
|
||||
<option value="60" <?php if ($expire_days === 60) { echo "selected"; } ?>>60 Days</option>
|
||||
<option value="90" <?php if ($expire_days === 90) { echo "selected"; } ?>>90 Days</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($client_url) { // filler ?>
|
||||
<div class="col-md-2"></div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="btn-group float-right">
|
||||
<a href="?<?php echo $client_url; ?>archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
|
||||
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
|
||||
|
||||
Reference in New Issue
Block a user