mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Simplify / rework some of the filter header logic and update filter vars in the rest of the code
This commit is contained in:
16
payments.php
16
payments.php
@@ -12,21 +12,21 @@ enforceUserPermission('module_financial');
|
||||
// Payment Method Filter
|
||||
if (isset($_GET['method']) & !empty($_GET['method'])) {
|
||||
$payment_method_query = "AND (payment_method = '" . sanitizeInput($_GET['method']) . "')";
|
||||
$method = nullable_htmlentities($_GET['method']);
|
||||
$method_filter = nullable_htmlentities($_GET['method']);
|
||||
} else {
|
||||
// Default - any
|
||||
$payment_method_query = '';
|
||||
$method = '';
|
||||
$method_filter = '';
|
||||
}
|
||||
|
||||
// Account Filter
|
||||
if (isset($_GET['account']) & !empty($_GET['account'])) {
|
||||
$account_query = 'AND (payment_account_id = ' . intval($_GET['account']) . ')';
|
||||
$account = intval($_GET['account']);
|
||||
$account_filter = intval($_GET['account']);
|
||||
} else {
|
||||
// Default - any
|
||||
$account_query = '';
|
||||
$account = '';
|
||||
$account_filter = '';
|
||||
}
|
||||
|
||||
//Rebuild URL
|
||||
@@ -69,7 +69,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<select class="form-control select2" name="account" onchange="this.form.submit()">
|
||||
<option value="" <?php if ($account == "") { echo "selected"; } ?>>- All Accounts -</option>
|
||||
<option value="">- All Accounts -</option>
|
||||
|
||||
<?php
|
||||
$sql_accounts_filter = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
@@ -77,7 +77,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$account_id = intval($row['account_id']);
|
||||
$account_name = nullable_htmlentities($row['account_name']);
|
||||
?>
|
||||
<option <?php if ($account == $account_id) { echo "selected"; } ?> value="<?php echo $account_id; ?>"><?php echo $account_name; ?></option>
|
||||
<option <?php if ($account_filter == $account_id) { echo "selected"; } ?> value="<?php echo $account_id; ?>"><?php echo $account_name; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@@ -89,14 +89,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<div class="col-sm-2">
|
||||
<div class="form-group">
|
||||
<select class="form-control select2" name="method" onchange="this.form.submit()">
|
||||
<option value="" <?php if ($method == "") { echo "selected"; } ?>>- All Payment Methods -</option>
|
||||
<option value="">- All Payment Methods -</option>
|
||||
|
||||
<?php
|
||||
$sql_payment_methods_filter = mysqli_query($mysqli, "SELECT DISTINCT payment_method FROM payments ORDER BY payment_method ASC");
|
||||
while ($row = mysqli_fetch_array($sql_payment_methods_filter)) {
|
||||
$payment_method = nullable_htmlentities($row['payment_method']);
|
||||
?>
|
||||
<option <?php if ($method == $payment_method) { echo "selected"; } ?>><?php echo $payment_method; ?></option>
|
||||
<option <?php if ($method_filter == $payment_method) { echo "selected"; } ?>><?php echo $payment_method; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user