diff --git a/cron.php b/cron.php
index cef7eba6..3cdbf338 100644
--- a/cron.php
+++ b/cron.php
@@ -446,7 +446,7 @@ if ($config_send_invoice_reminders == 1) {
// PAST DUE INVOICE Notifications
//$invoiceAlertArray = [$config_invoice_overdue_reminders];
- $invoiceAlertArray = [30,60,90,120,150,180,210,240,270,300,330,360,390,420,450,480,510,540,570,590,620];
+ $invoiceAlertArray = [30,60,90,120,150,180,210,240,270,300,330,360,390,420,450,480,510,540,570,590,620,650,680,710,740];
foreach ($invoiceAlertArray as $day) {
@@ -488,9 +488,9 @@ if ($config_send_invoice_reminders == 1) {
mysqli_query($mysqli, "UPDATE invoices SET invoice_amount = $new_invoice_amount WHERE invoice_id = $invoice_id");
//Insert Items into New Invoice
- mysqli_query($mysqli, "INSERT INTO invoice_items SET item_name = 'Late Fee', item_description = '$config_invoice_late_fee_percent% late fee applied on $todays_date', item_quantity = 1, item_price = $late_fee_amount, item_total = $late_fee_amount, item_invoice_id = $invoice_id");
+ mysqli_query($mysqli, "INSERT INTO invoice_items SET item_name = 'Late Fee', item_description = '$config_invoice_late_fee_percent% late fee applied on $todays_date', item_quantity = 1, item_price = $late_fee_amount, item_total = $late_fee_amount, item_order = 998, item_invoice_id = $invoice_id");
- mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Sent', history_description = 'Cron applied a late charge', history_invoice_id = $invoice_id");
+ mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Sent', history_description = 'Cron applied a late fee of $late_fee_amount', history_invoice_id = $invoice_id");
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Invoice Late Charge', notification = 'Invoice $invoice_prefix$invoice_number for $client_name in the amount of $invoice_amount was charged a late fee of $late_fee_amount', notification_action = 'invoice.php?invoice_id=$invoice_id', notification_client_id = $client_id, notification_entity_id = $invoice_id");
diff --git a/favicon.ico b/favicon.ico
new file mode 100644
index 00000000..725954c9
Binary files /dev/null and b/favicon.ico differ
diff --git a/functions.php b/functions.php
index 9fa0fb5a..ca3ddd24 100644
--- a/functions.php
+++ b/functions.php
@@ -201,7 +201,7 @@ function truncate($text, $chars) {
}
function formatPhoneNumber($phoneNumber) {
- $phoneNumber = preg_replace('/[^0-9]/', '', $phoneNumber);
+ $phoneNumber = $phoneNumber ? preg_replace('/[^0-9]/', '', $phoneNumber): "";
if (strlen($phoneNumber) > 10) {
$countryCode = substr($phoneNumber, 0, strlen($phoneNumber)-10);
@@ -853,7 +853,7 @@ function calculateAccountBalance($mysqli, $account_id) {
$row = mysqli_fetch_array($sql_account);
$opening_balance = floatval($row['opening_balance']);
$account_id = intval($row['account_id']);
-
+
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
$row = mysqli_fetch_array($sql_payments);
$total_payments = floatval($row['total_payments']);
@@ -928,7 +928,7 @@ function generateReadablePassword($security_level) {
}
function addToMailQueue($mysqli, $data) {
-
+
foreach ($data as $email) {
$from = strval($email['from']);
$from_name = strval($email['from_name']);
@@ -963,7 +963,7 @@ function calculateInvoiceBalance($mysqli, $invoice_id) {
"SELECT SUM(payment_amount) AS total_payments FROM payments
WHERE payment_invoice_id = $invoice_id
");
-
+
$row = mysqli_fetch_array($sql_payments);
$total_payments = floatval($row['total_payments']);
@@ -976,4 +976,4 @@ function calculateInvoiceBalance($mysqli, $invoice_id) {
return $balance;
-}
\ No newline at end of file
+}
diff --git a/guest_header.php b/guest_header.php
index 69a1adee..9a9b2616 100644
--- a/guest_header.php
+++ b/guest_header.php
@@ -24,6 +24,14 @@ $browser = sanitizeInput(getWebBrowser($user_agent));
+
+
+
+
+
diff --git a/guest_pay_invoice_stripe.php b/guest_pay_invoice_stripe.php
index 15ded8f5..43c2b24a 100644
--- a/guest_pay_invoice_stripe.php
+++ b/guest_pay_invoice_stripe.php
@@ -86,9 +86,12 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
if ($config_stripe_client_pays_fees == 1) {
$balance_before_fees = $balance_to_pay;
- // Calculate the Gateway fee
- $gateway_fee = round($balance_to_pay * $config_stripe_percentage_fee + $config_stripe_flat_fee, 2);
- $balance_to_pay = $balance_to_pay + $gateway_fee;
+ // See here for passing costs on to client https://support.stripe.com/questions/passing-the-stripe-fee-on-to-customers
+ // Calculate the amount to charge the client
+ $balance_to_pay = ($balance_to_pay + $config_stripe_flat_fee) / (1 - $config_stripe_percentage_fee);
+ // Calculate the fee amount
+ $gateway_fee = round($balance_to_pay - $balance_before_fees, 2);
+
}
//Round balance to pay to 2 decimal places
@@ -276,10 +279,18 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
// Check config to see if client pays fees is enabled or if should expense it
if ($config_stripe_client_pays_fees == 1) {
- // Calculate gateway expense fee
- $gateway_fee = round($balance_to_pay * $config_stripe_percentage_fee + $config_stripe_flat_fee, 2);
+ $balance_before_fees = $balance_to_pay;
+ // See here for passing costs on to client https://support.stripe.com/questions/passing-the-stripe-fee-on-to-customers
// Calculate the amount to charge the client
- $balance_to_pay = $balance_to_pay + $gateway_fee;
+ $balance_to_pay = ($balance_to_pay + $config_stripe_flat_fee) / (1 - $config_stripe_percentage_fee);
+ // Calculate the fee amount
+ $gateway_fee = round($balance_to_pay - $balance_before_fees, 2);
+
+ // Add as line item to client Invoice
+ mysqli_query($mysqli,"INSERT INTO invoice_items SET item_name = 'Gateway Fees', item_description = 'Payment Gateway Fees', item_quantity = 1, item_price = $gateway_fee, item_subtotal = $gateway_fee, item_total = $gateway_fee, item_order = 999, item_invoice_id = $invoice_id");
+ // Update the Amount on the invoice to include the gateway fee
+ $new_invoice_amount = $invoice_amount + $gateway_fee;
+ mysqli_query($mysqli,"UPDATE invoices SET invoice_amount = $new_invoice_amount WHERE invoice_id = $invoice_id");
}
// Check to see if Expense Fields are configured and client pays fee is off then create expense
diff --git a/guest_view_invoice.php b/guest_view_invoice.php
index d4233dd4..216c61ff 100644
--- a/guest_view_invoice.php
+++ b/guest_view_invoice.php
@@ -114,7 +114,14 @@ $amount_paid = floatval($row['amount_paid']);
$balance = $invoice_amount - $amount_paid;
// Calculate Gateway Fee
-$gateway_fee = round($balance * $config_stripe_percentage_fee + $config_stripe_flat_fee, 2);
+if ($config_stripe_client_pays_fees == 1) {
+ $balance_before_fees = $balance;
+ // See here for passing costs on to client https://support.stripe.com/questions/passing-the-stripe-fee-on-to-customers
+ // Calculate the amount to charge the client
+ $balance_to_pay = ($balance + $config_stripe_flat_fee) / (1 - $config_stripe_percentage_fee);
+ // Calculate the fee amount
+ $gateway_fee = round($balance_to_pay - $balance_before_fees, 2);
+}
//check to see if overdue
$invoice_color = $invoice_badge_color; // Default
diff --git a/header.php b/header.php
index 3eddc8ae..ad04705e 100644
--- a/header.php
+++ b/header.php
@@ -18,6 +18,14 @@ header("X-Frame-Options: DENY");
|
+
+
+
+
+
diff --git a/inc_confirm_modal.php b/inc_confirm_modal.php
index 4b73e490..828cc7c1 100644
--- a/inc_confirm_modal.php
+++ b/inc_confirm_modal.php
@@ -1,10 +1,10 @@
-
+
diff --git a/login.php b/login.php
index 1a38b930..5cf95135 100644
--- a/login.php
+++ b/login.php
@@ -272,6 +272,15 @@ if (isset($_POST['login'])) {
+
+
+
+
+
+
diff --git a/portal/login.php b/portal/login.php
index e018aba0..9619d54c 100644
--- a/portal/login.php
+++ b/portal/login.php
@@ -88,6 +88,14 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['login'])) {
+
+
+
+
+
diff --git a/portal/login_reset.php b/portal/login_reset.php
index 7faef5b1..4bb25f52 100644
--- a/portal/login_reset.php
+++ b/portal/login_reset.php
@@ -186,6 +186,14 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
+
+
+
+
+
diff --git a/portal/portal_header.php b/portal/portal_header.php
index 708311f2..237204a1 100644
--- a/portal/portal_header.php
+++ b/portal/portal_header.php
@@ -18,6 +18,14 @@ header("X-Frame-Options: DENY"); // Legacy
+
+
+
+
+
diff --git a/post/setting.php b/post/setting.php
index 220a132f..024e28c4 100644
--- a/post/setting.php
+++ b/post/setting.php
@@ -325,6 +325,46 @@ if (isset($_POST['edit_theme_settings'])) {
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
+if (isset($_POST['edit_favicon_settings'])) {
+
+ validateCSRFToken($_POST['csrf_token']);
+
+ validateAdminRole();
+
+ // Check to see if a file is attached
+ if ($_FILES['file']['tmp_name'] != '') {
+ if ($new_file_name = checkFileUpload($_FILES['file'], array('ico'))) {
+ $file_tmp_path = $_FILES['file']['tmp_name'];
+
+ // Delete old file
+ if(file_exists("uploads/favicon.ico")) {
+ unlink("uploads/favicon.ico");
+ }
+
+ // directory in which the uploaded file will be moved
+ $upload_file_dir = "uploads/";
+ //Force File Name
+ $new_file_name = "favicon.ico";
+ $dest_path = $upload_file_dir . $new_file_name;
+
+ move_uploaded_file($file_tmp_path, $dest_path);
+
+ $_SESSION['alert_message'] = 'File successfully uploaded.';
+ }else{
+
+ $_SESSION['alert_message'] = 'There was an error moving the file to upload directory. Please make sure the upload directory is writable by web server.';
+ }
+ }
+
+ //Logging
+ mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modify', log_description = '$session_name updated the favicon', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
+
+ $_SESSION['alert_message'] = "You updated the favicon";
+
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
+
+}
+
if (isset($_POST['edit_notification_settings'])) {
validateCSRFToken($_POST['csrf_token']);
diff --git a/settings_online_payment.php b/settings_online_payment.php
index 3345d69f..17367777 100644
--- a/settings_online_payment.php
+++ b/settings_online_payment.php
@@ -74,6 +74,7 @@ require_once "inc_all_settings.php";
+
Please click here for the latest Stripe Fees.
@@ -84,13 +85,14 @@ require_once "inc_all_settings.php";
+
Please click here for the latest Stripe Fees.
diff --git a/settings_theme.php b/settings_theme.php
index 401cf458..0b2879fb 100644
--- a/settings_theme.php
+++ b/settings_theme.php
@@ -44,6 +44,28 @@ require_once "inc_all_settings.php";