From 606f3061d0e487ddf32d583dcd0f84789fa59632 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 22 Jan 2025 18:55:05 -0500 Subject: [PATCH] Simplify / rework some of the filter header logic and update filter vars in the rest of the code --- admin_app_log.php | 16 +++++++------- admin_audit_log.php | 32 +++++++++++++-------------- client_assets.php | 8 +++---- client_contacts.php | 2 +- client_logins.php | 8 +++---- clients.php | 4 ++-- includes/filter_header.php | 44 +++++++++++++------------------------- invoices.php | 2 +- payments.php | 16 +++++++------- products.php | 8 +++---- transfers.php | 18 ++++++++-------- 11 files changed, 72 insertions(+), 86 deletions(-) diff --git a/admin_app_log.php b/admin_app_log.php index ac5283b5..f5aa1970 100644 --- a/admin_app_log.php +++ b/admin_app_log.php @@ -9,21 +9,21 @@ require_once "includes/inc_all_admin.php"; // Log Type Filter if (isset($_GET['type']) & !empty($_GET['type'])) { $log_type_query = "AND (app_log_type = '" . sanitizeInput($_GET['type']) . "')"; - $type = nullable_htmlentities($_GET['type']); + $type_filter = nullable_htmlentities($_GET['type']); } else { // Default - any $log_type_query = ''; - $type = ''; + $type_filter = ''; } // Log Category Filter if (isset($_GET['category']) & !empty($_GET['catergory'])) { $log_category_query = "AND (app_log_category = '" . sanitizeInput($_GET['category']) . "')"; - $category = nullable_htmlentities($_GET['category']); + $category_filter = nullable_htmlentities($_GET['category']); } else { // Default - any $log_category_query = ''; - $category = ''; + $category_filter = ''; } //Rebuild URL @@ -63,14 +63,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- + - + diff --git a/admin_audit_log.php b/admin_audit_log.php index 95f02047..980035a3 100644 --- a/admin_audit_log.php +++ b/admin_audit_log.php @@ -9,41 +9,41 @@ require_once "includes/inc_all_admin.php"; // User Filter if (isset($_GET['user']) & !empty($_GET['user'])) { $user_query = 'AND (log_user_id = ' . intval($_GET['user']) . ')'; - $user = intval($_GET['user']); + $user_filter = intval($_GET['user']); } else { // Default - any $user_query = ''; - $user = ''; + $user_filter = ''; } // Client Filter if (isset($_GET['client']) & !empty($_GET['client'])) { $client_query = 'AND (log_client_id = ' . intval($_GET['client']) . ')'; - $client = intval($_GET['client']); + $client_filter = intval($_GET['client']); } else { // Default - any $client_query = ''; - $client = ''; + $client_filter = ''; } // Log Type Filter if (isset($_GET['type']) & !empty($_GET['type'])) { $log_type_query = "AND (log_type = '" . sanitizeInput($_GET['type']) . "')"; - $type = nullable_htmlentities($_GET['type']); + $type_filter = nullable_htmlentities($_GET['type']); } else { // Default - any $log_type_query = ''; - $type = ''; + $type_filter = ''; } // Log Action Filter if (isset($_GET['action']) & !empty($_GET['action'])) { $log_action_query = "AND (log_action = '" . sanitizeInput($_GET['action']) . "')"; - $action = nullable_htmlentities($_GET['action']); + $action_filter = nullable_htmlentities($_GET['action']); } else { // Default - any $log_action_query = ''; - $action = ''; + $action_filter = ''; } //Rebuild URL @@ -87,7 +87,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- + - + @@ -127,14 +127,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- + - + diff --git a/client_assets.php b/client_assets.php index bb67bf17..9029e776 100644 --- a/client_assets.php +++ b/client_assets.php @@ -28,11 +28,11 @@ if (isset($_GET['type']) && ($_GET['type']) == 'workstation') { // Location Filter if (isset($_GET['location']) & !empty($_GET['location'])) { $location_query = 'AND (asset_location_id = ' . intval($_GET['location']) . ')'; - $location = intval($_GET['location']); + $location_filter = intval($_GET['location']); } else { // Default - any $location_query = ''; - $location = ''; + $location_filter = ''; } //Get Asset Counts @@ -159,7 +159,7 @@ if (mysqli_num_rows($os_sql) > 0) {
- +
- + - + - + @@ -89,14 +89,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- + - + diff --git a/transfers.php b/transfers.php index 26a024ba..5566ed1f 100644 --- a/transfers.php +++ b/transfers.php @@ -11,21 +11,21 @@ enforceUserPermission('module_financial'); // Account Transfer From Filter if (isset($_GET['account_from']) & !empty($_GET['account_from'])) { $account_from_query = 'AND (expense_account_id = ' . intval($_GET['account_from']) . ')'; - $account_from = intval($_GET['account_from']); + $account_from_filter = intval($_GET['account_from']); } else { // Default - any $account_from_query = ''; - $account_from = ''; + $account_from_filter = ''; } // Account Transfer To Filter if (isset($_GET['account_to']) & !empty($_GET['account_to'])) { $account_to_query = 'AND (revenue_account_id = ' . intval($_GET['account_to']) . ')'; - $account_to = intval($_GET['account_to']); + $account_to_filter = intval($_GET['account_to']); } else { // Default - any $account_to_query = ''; - $account_to = ''; + $account_to_filter = ''; } @@ -69,7 +69,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
-
" id="advancedFilter"> +
" id="advancedFilter">
@@ -103,7 +103,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- + - +