From e79ba696bd22cd56b95d2cdfa3538a7a7afcfd2d Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Wed, 1 Feb 2023 21:27:44 +0000 Subject: [PATCH 1/2] Add comments to role validation functions for clarity --- functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions.php b/functions.php index 55506058..e75032b9 100644 --- a/functions.php +++ b/functions.php @@ -50,7 +50,7 @@ function initials($str) { $ret = ''; foreach (explode(' ', $str) as $word) $ret .= strtoupper($word[0]); - $ret = substr($ret,0, 2); + $ret = substr($ret,0, 2); return $ret; } } @@ -474,6 +474,7 @@ function validateAdminRole() { } } +// Validates a user is a tech (or admin). Stops page load and attempts to direct away from the page if not (i.e. user is an accountant) function validateTechRole() { if (!isset($_SESSION['user_role']) || $_SESSION['user_role'] == 1) { $_SESSION['alert_type'] = "danger"; @@ -483,6 +484,7 @@ function validateTechRole() { } } +// Validates a user is an accountant (or admin). Stops page load and attempts to direct away from the page if not (i.e. user is a tech) function validateAccountantRole() { if (!isset($_SESSION['user_role']) || $_SESSION['user_role'] == 2) { $_SESSION['alert_type'] = "danger"; From baf03d46ac79b0ea96a45e2ece391aed375f9cdb Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Wed, 1 Feb 2023 21:28:17 +0000 Subject: [PATCH 2/2] Enforce accountant/admin roles to view financial reports --- report_expense_by_vendor.php | 138 +++--- report_expense_summary.php | 11 +- report_income_by_client.php | 120 ++--- report_income_summary.php | 6 +- report_profit_loss.php | 827 +++++++++++++++++---------------- report_recurring_by_client.php | 99 ++-- report_tax_summary.php | 527 ++++++++++----------- reports_side_nav.php | 126 ++--- 8 files changed, 935 insertions(+), 919 deletions(-) diff --git a/report_expense_by_vendor.php b/report_expense_by_vendor.php index 35e1d104..132c5432 100644 --- a/report_expense_by_vendor.php +++ b/report_expense_by_vendor.php @@ -1,16 +1,18 @@ - - -
-
-

Expense By Vendor

-
- +
+
+

Expense By Vendor

+
+ +
+
+
+
+ +
+ +
+ + + + + + + + + 599) { + + ?> + + + + + + + +
VendorPaid
+
+
-
-
-
- -
- -
- - - - - - - - - 599) { - - ?> - - - - - - - -
VendorPaid
-
-
-
- - \ No newline at end of file + diff --git a/report_expense_summary.php b/report_expense_summary.php index 741cd84c..20674a4e 100644 --- a/report_expense_summary.php +++ b/report_expense_summary.php @@ -1,14 +1,17 @@ -
- +