From 52b0a17e029059f8724fa8dd7f1c771664fdc33a Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 5 Sep 2023 16:42:33 -0400 Subject: [PATCH] added more actionable notifications --- cron.php | 16 ++++++++-------- guest_pay_invoice_stripe.php | 2 +- guest_view_invoice.php | 2 +- guest_view_quote.php | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cron.php b/cron.php index 37791d01..2dc4e676 100644 --- a/cron.php +++ b/cron.php @@ -177,7 +177,7 @@ foreach ($domainAlertArray as $day) { $client_id = intval($row['client_id']); $client_name = sanitizeInput($row['client_name']); - mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Domain', notification = 'Domain $domain_name for $client_name will expire in $day Days on $domain_expire', notification_client_id = $client_id"); + mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Domain', notification = 'Domain $domain_name for $client_name will expire in $day Days on $domain_expire', notification_action = 'client_domains.php?client_id=$client_id', notification_client_id = $client_id"); } @@ -207,7 +207,7 @@ foreach ($certificateAlertArray as $day) { $client_id = intval($row['client_id']); $client_name = sanitizeInput($row['client_name']); - mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Certificate', notification = 'Certificate $certificate_name for $client_name will expire in $day Days on $certificate_expire', notification_client_id = $client_id"); + mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Certificate', notification = 'Certificate $certificate_name for $client_name will expire in $day Days on $certificate_expire', notification_action = 'client_certificates.php?client_id=$client_id', notification_client_id = $client_id"); } @@ -236,7 +236,7 @@ foreach ($warranty_alert_array as $day) { $client_id = intval($row['client_id']); $client_name = sanitizeInput($row['client_name']); - mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Asset', notification = 'Asset $asset_name warranty for $client_name will expire in $day Days on $asset_warranty_expire', notification_client_id = $client_id"); + mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Asset', notification = 'Asset $asset_name warranty for $client_name will expire in $day Days on $asset_warranty_expire', notification_action = 'client_assets.php?client_id=$client_id', notification_client_id = $client_id"); } @@ -474,11 +474,11 @@ foreach ($invoiceAlertArray as $day) { 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 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_client_id = $client_id, notification_entity_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"); } - mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Invoice Overdue', notification = 'Invoice $invoice_prefix$invoice_number for $client_name in the amount of $invoice_amount is overdue by $day days', notification_client_id = $client_id, notification_entity_id = $invoice_id"); + mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Invoice Overdue', notification = 'Invoice $invoice_prefix$invoice_number for $client_name in the amount of $invoice_amount is overdue by $day days', notification_action = 'invoice.php?invoice_id=$invoice_id', notification_client_id = $client_id, notification_entity_id = $invoice_id"); $subject = "Overdue Invoice $invoice_prefix$invoice_number"; $body = "Hello $contact_name,

Our records indicate that we have not yet received payment for the invoice $invoice_prefix$invoice_number. We kindly request that you submit your payment as soon as possible. If you have any questions or concerns, please do not hesitate to contact us at $company_phone. @@ -572,7 +572,7 @@ while ($row = mysqli_fetch_array($sql_recurring)) { mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Sent', history_description = 'Invoice Generated from Recurring!', history_invoice_id = $new_invoice_id"); - mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Recurring Sent', notification = 'Recurring Invoice $config_invoice_prefix$new_invoice_number for $client_name Sent', notification_client_id = $client_id, notification_entity_id = $new_invoice_id"); + mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Recurring Sent', notification = 'Recurring Invoice $config_invoice_prefix$new_invoice_number for $client_name Sent', notification_action = 'invoice.php?invoice_id=$new_invoice_id', notification_client_id = $client_id, notification_entity_id = $new_invoice_id"); //Update recurring dates @@ -685,7 +685,7 @@ while ($row = mysqli_fetch_array($sql_recurring_expenses)) { $expense_id = mysqli_insert_id($mysqli); - mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Expense Created', notification = 'Expense $recurring_expense_description created from recurring expenses', notification_client_id = $recurring_expense_client_id, notification_entity_id = $expense_id"); + mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Expense Created', notification = 'Expense $recurring_expense_description created from recurring expenses', notification_action = 'expenses.php', notification_client_id = $recurring_expense_client_id, notification_entity_id = $expense_id"); // Update recurring dates using calculated next billing date @@ -947,7 +947,7 @@ if ($config_telemetry == 1) { */ // Send Alert to inform Cron was run -mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Cron', notification = 'Cron.php successfully executed'"); +mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Cron', notification = 'Cron.php successfully executed', notification_action = 'logs.php'"); // Logging mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Ended', log_description = 'Cron executed successfully for $company_name'"); diff --git a/guest_pay_invoice_stripe.php b/guest_pay_invoice_stripe.php index e81d0cfa..4cfb8e9e 100644 --- a/guest_pay_invoice_stripe.php +++ b/guest_pay_invoice_stripe.php @@ -248,7 +248,7 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Paid', history_description = 'Payment added - $ip - $os - $browser', history_invoice_id = $invoice_id"); // Notify - mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Invoice Paid', notification = 'Invoice $invoice_prefix$invoice_number has been paid - $ip - $os - $browser', notification_client_id = $pi_client_id"); + mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Invoice Paid', notification = 'Invoice $invoice_prefix$invoice_number has been paid - $ip - $os - $browser', notification_action = 'invoice.php?invoice_id=$invoice_id', notification_client_id = $pi_client_id"); // Logging $extended_log_desc = ''; diff --git a/guest_view_invoice.php b/guest_view_invoice.php index 361e8b99..047a1676 100644 --- a/guest_view_invoice.php +++ b/guest_view_invoice.php @@ -95,7 +95,7 @@ mysqli_query($mysqli, "INSERT INTO history SET history_status = '$invoice_status if ($invoice_status !== 'Paid') { //$client_name_escaped = sanitizeInput($row['client_name']); - mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Invoice Viewed', notification = 'Invoice $invoice_prefix$invoice_number has been viewed by $client_name_escaped - $ip - $os - $browser', notification_client_id = $client_id, notification_entity_id = $invoice_id"); + mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Invoice Viewed', notification = 'Invoice $invoice_prefix$invoice_number has been viewed by $client_name_escaped - $ip - $os - $browser', notification_action = 'invoice.php?invoice_id=$invoice_id', notification_client_id = $client_id, notification_entity_id = $invoice_id"); } $sql_payments = mysqli_query($mysqli, "SELECT * FROM payments, accounts WHERE payment_account_id = account_id AND payment_invoice_id = $invoice_id ORDER BY payments.payment_id DESC"); diff --git a/guest_view_quote.php b/guest_view_quote.php index 2a9f881a..d816ce0e 100644 --- a/guest_view_quote.php +++ b/guest_view_quote.php @@ -88,7 +88,7 @@ if ($quote_status == 'Sent') { mysqli_query($mysqli, "INSERT INTO history SET history_status = '$quote_status', history_description = 'Quote viewed - $ip - $os - $browser', history_quote_id = $quote_id"); if ($quote_status == "Draft" || $quote_status == "Sent" || $quote_status == "Viewed") { - mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Quote Viewed', notification = 'Quote $quote_prefix$quote_number has been viewed by $client_name_escaped - $ip - $os - $browser', notification_client_id = $client_id, notification_entity_id = $quote_id"); + mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Quote Viewed', notification = 'Quote $quote_prefix$quote_number has been viewed by $client_name_escaped - $ip - $os - $browser', notification_action = 'quote.php?quote_id=$quote_id', notification_client_id = $client_id, notification_entity_id = $quote_id"); } ?>