From 5fccf5ffd44ab7d37aa08f2c1ee9015e9061eba0 Mon Sep 17 00:00:00 2001 From: git-kup <148492449+git-kup@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:33:20 -0500 Subject: [PATCH 001/366] Update admin_role.php --- admin_role.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin_role.php b/admin_role.php index 9d592db3..1aaee078 100644 --- a/admin_role.php +++ b/admin_role.php @@ -21,7 +21,7 @@ $sql = mysqli_query( $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); ?> -
Roles are still in development. Permissions may not be fully enforced.
+
Roles are still in development. Permissions may not be fully enforced.
From d0998b7d0df972bf658c53e94ec5418de21f13b5 Mon Sep 17 00:00:00 2001 From: git-kup <148492449+git-kup@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:35:08 -0500 Subject: [PATCH 002/366] Update admin_role.php --- admin_role.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin_role.php b/admin_role.php index 1aaee078..241a116f 100644 --- a/admin_role.php +++ b/admin_role.php @@ -21,7 +21,7 @@ $sql = mysqli_query( $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); ?> -
Roles are still in development. Permissions may not be fully enforced.
+
Roles are still in development. Permissions may not be fully enforced.
From 56f00fe3667b7805496df87103c5a2944dc8589d Mon Sep 17 00:00:00 2001 From: git-kup <148492449+git-kup@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:50:33 -0500 Subject: [PATCH 003/366] Update global_search.php --- global_search.php | 1 - 1 file changed, 1 deletion(-) diff --git a/global_search.php b/global_search.php index b4de3ce2..a182669e 100644 --- a/global_search.php +++ b/global_search.php @@ -146,7 +146,6 @@ if (isset($_GET['query'])) {

Global Search

-
0) { ?> From 4627736a8cdca9ff2af0012c172fdfb3f9c7e2aa Mon Sep 17 00:00:00 2001 From: git-kup <148492449+git-kup@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:10:22 -0500 Subject: [PATCH 004/366] make global search nicer --- global_search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global_search.php b/global_search.php index a182669e..e9c1f06e 100644 --- a/global_search.php +++ b/global_search.php @@ -144,7 +144,7 @@ if (isset($_GET['query'])) {
-
+

Global Search

From 7ee04fa26a92c9e5a2ba950a35f5843a76691323 Mon Sep 17 00:00:00 2001 From: gt-business Date: Wed, 18 Dec 2024 18:48:42 -0500 Subject: [PATCH 005/366] Update global_search.php --- global_search.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/global_search.php b/global_search.php index e9c1f06e..4740b335 100644 --- a/global_search.php +++ b/global_search.php @@ -142,11 +142,12 @@ if (isset($_GET['query'])) { ?> -
+
+
+

Global Search

+
+
-
-

Global Search

-
0) { ?> From c5cbfd50d2af8bc959f990901c97538a865e5aae Mon Sep 17 00:00:00 2001 From: gt-business Date: Wed, 18 Dec 2024 18:49:38 -0500 Subject: [PATCH 006/366] Update global_search.php --- global_search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global_search.php b/global_search.php index 4740b335..48d6f5d2 100644 --- a/global_search.php +++ b/global_search.php @@ -142,7 +142,7 @@ if (isset($_GET['query'])) { ?> -
+

Global Search

From 7007c34e8d4e8baae6f3c02069694461f2706ff7 Mon Sep 17 00:00:00 2001 From: gt-business Date: Wed, 18 Dec 2024 18:56:26 -0500 Subject: [PATCH 007/366] Update global_search.php --- global_search.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/global_search.php b/global_search.php index 48d6f5d2..c6c05fcf 100644 --- a/global_search.php +++ b/global_search.php @@ -141,14 +141,14 @@ if (isset($_GET['query'])) { ?> - -
-
-

Global Search

+
+
+
+

Global Search

+
- 0) { ?> From 8e385d8599879b19967a1786969fd82ea48d7c45 Mon Sep 17 00:00:00 2001 From: gt-business Date: Wed, 18 Dec 2024 18:57:10 -0500 Subject: [PATCH 008/366] Update global_search.php --- global_search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global_search.php b/global_search.php index c6c05fcf..21fd86ee 100644 --- a/global_search.php +++ b/global_search.php @@ -141,13 +141,13 @@ if (isset($_GET['query'])) { ?> -
+

Global Search

-
+ 0) { ?> From bd7a15680054d2e67b96ddb02351c4df8b55e08d Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Fri, 20 Dec 2024 11:23:41 +0000 Subject: [PATCH 009/366] Move more things to new role perms system --- check_login.php | 11 +++++++---- inc_all_client.php | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/check_login.php b/check_login.php index 05e6cd94..bd9570df 100644 --- a/check_login.php +++ b/check_login.php @@ -59,6 +59,8 @@ $session_user_role = intval($row['user_role']); $session_user_role_display = sanitizeInput($row['user_role_name']); if (isset($row['user_role_is_admin']) && $row['user_role_is_admin'] == 1) { $session_is_admin = true; +} else { + $session_is_admin = false; } $session_user_config_force_mfa = intval($row['user_config_force_mfa']); $user_config_records_per_page = intval($row['user_config_records_per_page']); @@ -88,12 +90,13 @@ try { $client_access_string = implode(',', $client_access_array); - // Role / Client Access Permission Check - if ($session_user_role < 3 && !empty($client_access_string)) { + // Client access permission check + // Default allow, if a list of allowed clients is set & the user isn't an admin, restrict them + $access_permission_query = ""; + if ($client_access_string && !$session_is_admin) { $access_permission_query = "AND clients.client_id IN ($client_access_string)"; - } else { - $access_permission_query = ""; } + } catch (Exception $e) { // Handle exception error_log('MySQL error: ' . $e->getMessage()); diff --git a/inc_all_client.php b/inc_all_client.php index d8337b29..064ec7af 100644 --- a/inc_all_client.php +++ b/inc_all_client.php @@ -12,8 +12,9 @@ enforceUserPermission('module_client'); if (isset($_GET['client_id'])) { $client_id = intval($_GET['client_id']); - // Check to see if the logged in user has permission to access this client (Admins have access to all no matter what perms are set) - if(!in_array($client_id, $client_access_array) AND !empty($client_access_string) AND $session_user_role < 3) { + // Client Access Check + // Ensure the user has permission to access this client (admins ignored) + if (!in_array($client_id, $client_access_array) AND !empty($client_access_string) AND !$session_is_admin) { // Logging mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Client', log_action = 'Access', log_description = '$session_name was denied permission from accessing client', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $client_id"); @@ -21,7 +22,6 @@ if (isset($_GET['client_id'])) { $_SESSION['alert_message'] = "Access Denied - You do not have permission to access that client!"; echo ""; - exit(); } @@ -310,4 +310,4 @@ require_once "filter_header.php"; ?> - \ No newline at end of file + From 63015ab22db9c4ee0d46c408a4a807d103a55cea Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 21 Dec 2024 16:46:21 -0500 Subject: [PATCH 010/366] Feature: Recurring Payments created DB Structure --- database_updates.php | 26 +++++++++++++++++++++++--- database_version.php | 2 +- db.sql | 24 +++++++++++++++++++++++- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/database_updates.php b/database_updates.php index 0b5925cc..3a7fac23 100644 --- a/database_updates.php +++ b/database_updates.php @@ -2376,10 +2376,30 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.3'"); } - // if (CURRENT_DATABASE_VERSION == '1.7.3') { - // // Insert queries here required to update to DB version 1.7.4 + if (CURRENT_DATABASE_VERSION == '1.7.3') { + + // Add Recurring Payments + mysqli_query($mysqli, "CREATE TABLE `recurring_payments` ( + `recurring_payment_id` INT(11) NOT NULL AUTO_INCREMENT, + `recurring_payment_amount` DECIMAL(15,2) NOT NULL, + `recurring_payment_currency_code` VARCHAR(10) NOT NULL, + `recurring_payment_method` VARCHAR(200) NOT NULL, + `recurring_payment_created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(), + `recurring_payment_updated_at` DATETIME DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `recurring_payment_archived_at` DATETIME DEFAULT NULL, + `recurring_payment_account_id` INT(11) NOT NULL, + `recurring_payment_recurring_expense_id` INT(11) NOT NULL DEFAULT 0, + `recurring_payment_recurring_invoice_id` INT(11) NOT NULL, + PRIMARY KEY (`recurring_payment_id`) + )"); + + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.4'"); + } + + // if (CURRENT_DATABASE_VERSION == '1.7.4') { + // // Insert queries here required to update to DB version 1.7.5 // // Then, update the database to the next sequential version - // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.4'"); + // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.7.5'"); // } } else { diff --git a/database_version.php b/database_version.php index d959034c..1d0be201 100644 --- a/database_version.php +++ b/database_version.php @@ -5,4 +5,4 @@ * It is used in conjunction with database_updates.php */ -DEFINE("LATEST_DATABASE_VERSION", "1.7.3"); +DEFINE("LATEST_DATABASE_VERSION", "1.7.4"); diff --git a/db.sql b/db.sql index 3675dc53..9e340da1 100644 --- a/db.sql +++ b/db.sql @@ -1383,6 +1383,28 @@ CREATE TABLE `recurring_expenses` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `recurring_payments` +-- + +DROP TABLE IF EXISTS `recurring_payments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `recurring_payments` ( + `recurring_payment_id` int(11) NOT NULL AUTO_INCREMENT, + `recurring_payment_amount` decimal(15,2) NOT NULL, + `recurring_payment_currency_code` varchar(10) NOT NULL, + `recurring_payment_method` varchar(200) NOT NULL, + `recurring_payment_created_at` datetime NOT NULL DEFAULT current_timestamp(), + `recurring_payment_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), + `recurring_payment_archived_at` datetime DEFAULT NULL, + `recurring_payment_account_id` int(11) NOT NULL, + `recurring_payment_recurring_expense_id` int(11) NOT NULL DEFAULT 0, + `recurring_payment_recurring_invoice_id` int(11) NOT NULL, + PRIMARY KEY (`recurring_payment_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `remember_tokens` -- @@ -2266,4 +2288,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-12-13 15:11:31 +-- Dump completed on 2024-12-21 16:44:59 From 87a86803ee7410fd48eca0c7e821cc163d935b3f Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 21 Dec 2024 18:49:42 -0500 Subject: [PATCH 011/366] Added Recurring Payment Creation and Deletion and display in the recurring Invoice sections, still not operational need to add to cron --- client_recurring_invoices.php | 32 ++++++++++++-- post/user/invoice.php | 58 +++++++++++++++++++++++++ recurring_invoices.php | 25 ++++++++++- recurring_payment_add_modal.php | 77 +++++++++++++++++++++++++++++++++ 4 files changed, 187 insertions(+), 5 deletions(-) create mode 100644 recurring_payment_add_modal.php diff --git a/client_recurring_invoices.php b/client_recurring_invoices.php index 9395cb3d..bd0593bd 100644 --- a/client_recurring_invoices.php +++ b/client_recurring_invoices.php @@ -16,6 +16,7 @@ $sql = mysqli_query( $mysqli, "SELECT * FROM recurring LEFT JOIN categories ON recurring_category_id = category_id + LEFT JOIN recurring_payments ON recurring_payment_recurring_invoice_id = recurring_id WHERE recurring_client_id = $client_id AND (CONCAT(recurring_prefix,recurring_number) LIKE '%$q%' OR recurring_frequency LIKE '%$q%' OR recurring_scope LIKE '%$q%' OR category_name LIKE '%$q%') ORDER BY $sort $order LIMIT $record_from, $record_to"); @@ -104,6 +105,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); Category + + + Auto Pay + + Status @@ -140,6 +146,22 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $status = "Inactive"; $status_badge_color = "secondary"; } + $recurring_payment_recurring_invoice_id = intval($row['recurring_payment_recurring_invoice_id']); + if ($recurring_payment_recurring_invoice_id) { + $auto_pay_display = " + Yes + + + + "; + } else { + $auto_pay_display = " + + Create + + "; + require "recurring_payment_add_modal.php"; + } ?> @@ -151,10 +173,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + - - - + + +
-
@@ -176,5 +176,5 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
-
-
@@ -34,5 +34,5 @@ require_once "inc_all_admin.php";
-
@@ -194,4 +194,4 @@ if (isset($_GET['archived'])) { - @@ -149,5 +149,5 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); close(); - + - @@ -146,4 +146,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); diff --git a/admin_role.php b/admin_role.php index 800b58cc..62086cc2 100644 --- a/admin_role.php +++ b/admin_role.php @@ -4,7 +4,7 @@ $sort = "user_role_is_admin"; $order = "DESC"; -require_once "inc_all_admin.php"; +require_once "includes/inc_all_admin.php"; //Rebuild URL @@ -134,7 +134,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - @@ -143,5 +143,5 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); require_once "admin_role_add_modal.php"; -require_once "footer.php"; +require_once "includes/footer.php"; diff --git a/admin_settings_ai.php b/admin_settings_ai.php index 91eba539..894859b8 100644 --- a/admin_settings_ai.php +++ b/admin_settings_ai.php @@ -1,6 +1,6 @@
@@ -73,5 +73,5 @@ require_once "inc_all_admin.php";
- @@ -120,5 +120,5 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
@@ -249,4 +249,4 @@ require_once "inc_all_admin.php";
@@ -39,5 +39,5 @@ require_once "inc_all_admin.php";
-
@@ -102,5 +102,5 @@ require_once "inc_all_admin.php";
@@ -327,5 +327,5 @@ require_once "inc_all_admin.php"; -
@@ -78,5 +78,5 @@ require_once "inc_all_admin.php";
@@ -193,4 +193,4 @@ require_once "inc_all_admin.php";
@@ -151,5 +151,5 @@ require_once "inc_all_admin.php";
@@ -41,4 +41,4 @@ require_once "inc_all_admin.php";
@@ -54,5 +54,5 @@ require_once "inc_all_admin.php";
@@ -62,5 +62,5 @@ require_once "inc_all_admin.php";
@@ -38,5 +38,5 @@ require_once "inc_all_admin.php";
@@ -63,5 +63,5 @@ require_once "inc_all_admin.php";
@@ -82,5 +82,5 @@ require_once "inc_all_admin.php";
- @@ -136,5 +136,5 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - @@ -130,5 +130,5 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - @@ -131,5 +131,5 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - - @@ -239,5 +239,5 @@ require_once "admin_user_export_modal.php"; require_once "admin_user_all_reset_password_modal.php"; -require_once "footer.php"; +require_once "includes/footer.php"; diff --git a/admin_vendor_template.php b/admin_vendor_template.php index 02694440..f75cd9fb 100644 --- a/admin_vendor_template.php +++ b/admin_vendor_template.php @@ -4,7 +4,7 @@ $sort = "vendor_name"; $order = "ASC"; -require_once "inc_all_admin.php"; +require_once "includes/inc_all_admin.php"; //Rebuild URL @@ -164,7 +164,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - @@ -172,5 +172,5 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + @@ -569,7 +581,11 @@ if (isset($_GET['asset_id'])) { - + @@ -589,7 +605,8 @@ if (isset($_GET['asset_id'])) { + data-ajax-id="" + > Edit )"> @@ -676,7 +693,15 @@ if (isset($_GET['asset_id'])) { ?> - $software_version"; ?> + + + $software_version"; ?> + + @@ -871,7 +896,15 @@ if (isset($_GET['asset_id'])) { ?> - + + + + + @@ -885,8 +918,11 @@ if (isset($_GET['asset_id'])) {