From 56a5e903df5f6b64118eeb1afa4ae046cd7c9d8b Mon Sep 17 00:00:00 2001 From: o-psi Date: Sat, 14 Oct 2023 23:33:49 -0500 Subject: [PATCH 1/7] added unarchiving to account types post --- post/account_type.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/post/account_type.php b/post/account_type.php index 42a02106..7c3fb256 100644 --- a/post/account_type.php +++ b/post/account_type.php @@ -86,3 +86,17 @@ if (isset($_GET['archive_account_type'])) { header("Location: " . $_SERVER["HTTP_REFERER"]); } + +if (isset($_GET['unarchive_account_type'])) { + $account_type_id = intval($_GET['unarchive_account_type']); + + mysqli_query($mysqli,"UPDATE account_types SET account_type_archived_at = NULL WHERE account_type_id = $account_type_id"); + + //logging + mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Account Type', log_action = 'Unarchive', log_description = '$account_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent'"); + + $_SESSION['alert_message'] = "Account Unarchived"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} \ No newline at end of file From 68b232e4fdbcbf93f10f97196718348964e73695 Mon Sep 17 00:00:00 2001 From: o-psi Date: Sat, 14 Oct 2023 23:34:14 -0500 Subject: [PATCH 2/7] set default per type page --- settings_account_types_add_modal.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/settings_account_types_add_modal.php b/settings_account_types_add_modal.php index 631e691c..141c25e0 100644 --- a/settings_account_types_add_modal.php +++ b/settings_account_types_add_modal.php @@ -16,10 +16,18 @@
From ab308af4f9320f3e29c9ae53cdcfffe75a664149 Mon Sep 17 00:00:00 2001 From: o-psi Date: Sat, 14 Oct 2023 23:34:31 -0500 Subject: [PATCH 3/7] changed number to name --- settings_account_types_edit_modal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings_account_types_edit_modal.php b/settings_account_types_edit_modal.php index d75d805f..a82b2081 100644 --- a/settings_account_types_edit_modal.php +++ b/settings_account_types_edit_modal.php @@ -13,7 +13,7 @@
- +
From 1f3c103032969a67e2ea8c5c5afc5114f2bbf1ef Mon Sep 17 00:00:00 2001 From: o-psi Date: Sat, 14 Oct 2023 23:34:54 -0500 Subject: [PATCH 4/7] changed view from long list to broken down by type --- settings_account_types.php | 105 ++++++++++++++++++++++++++++--------- 1 file changed, 80 insertions(+), 25 deletions(-) diff --git a/settings_account_types.php b/settings_account_types.php index 55134c03..8663cd41 100644 --- a/settings_account_types.php +++ b/settings_account_types.php @@ -5,11 +5,40 @@ require_once("inc_all_settings.php"); $sort = "account_type_id"; $order = "ASC"; +if (isset($_GET['account_type'])) { + $account_type = sanitizeInput($_GET['account_type']); + switch ($account_type) { + case "Assets": + $account_type_id_min = "10"; + $account_type_id_max = "19"; + break; + case "Liabilities": + $account_type_id_min = "20"; + $account_type_id_max = "29"; + break; + case "Equity": + $account_type_id_min = "30"; + $account_type_id_max = "39"; + break; + default: + $account_type_id_min = "10"; + $account_type_id_max = "39"; + } +} else { + if (isset($_GET['archived'])) { + $account_type_id_min = "10"; + $account_type_id_max = "39"; } + +} + + $sql = mysqli_query( $mysqli, "SELECT * FROM account_types - WHERE account_type_archived_at IS NULL + WHERE account_type_$archive_query + AND account_type_id >= $account_type_id_min + AND account_type_id <= $account_type_id_max ORDER BY $sort $order" ); @@ -21,17 +50,41 @@ $num_rows = mysqli_num_rows($sql);

Finance Account Types

- +
+
- @@ -43,45 +96,47 @@ $num_rows = mysqli_num_rows($sql); $account_type_id = nullable_htmlentities($row['account_type_id']); $account_type_name = nullable_htmlentities($row['account_type_name']); $account_type_description = nullable_htmlentities($row['account_type_description']); - $account_type_group = $row['account_type_id']; - - if($account_type_group < 20) { - $account_type_group_name = "Assets"; - } elseif($account_type_group < 30) { - $account_type_group_name = "Liabilities"; - } elseif($account_type_group < 40) { - $account_type_group_name = "Equity"; - } else { - $account_type_group_name = "Other"; - } - - ?> + ?> - - - - + + + - Date: Sat, 14 Oct 2023 23:54:12 -0500 Subject: [PATCH 5/7] Fixed a bug with not showing unless query given --- settings_account_types.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/settings_account_types.php b/settings_account_types.php index 8663cd41..be7e0503 100644 --- a/settings_account_types.php +++ b/settings_account_types.php @@ -25,10 +25,8 @@ if (isset($_GET['account_type'])) { $account_type_id_max = "39"; } } else { - if (isset($_GET['archived'])) { $account_type_id_min = "10"; - $account_type_id_max = "39"; } - + $account_type_id_max = "39"; } From 845b2397fbb3b4f81205869df25fd4054ecf2e1b Mon Sep 17 00:00:00 2001 From: o-psi Date: Sun, 15 Oct 2023 00:00:03 -0500 Subject: [PATCH 6/7] Add 'all' button --- settings_account_types.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/settings_account_types.php b/settings_account_types.php index be7e0503..81282e38 100644 --- a/settings_account_types.php +++ b/settings_account_types.php @@ -55,6 +55,11 @@ $num_rows = mysqli_num_rows($sql);
Account Type ID Account Type NameType Group Description
+ + + + + +
@@ -123,17 +139,17 @@ $num_rows = mysqli_num_rows($sql); - - Archive - + + Archive + - - Unarchive - + + Unarchive + - +