diff --git a/cron.php b/cron.php index 47066c09..5f4defcd 100644 --- a/cron.php +++ b/cron.php @@ -258,7 +258,7 @@ if ($config_enable_cron == 1) { $id = mysqli_insert_id($mysqli); // Logging - mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Ticket', log_action = 'Create', log_description = 'System created scheduled $frequency ticket - $subject', log_client_id = $client_id, log_user_id = $created_id"); + mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Ticket', log_action = 'Create', log_description = 'System created scheduled $frequency ticket - $subject', log_client_id = $client_id, log_user_id = $created_id`"); // E-mail client if (!empty($config_smtp_host) && $config_ticket_client_general_notifications == 1) { @@ -368,7 +368,7 @@ if ($config_enable_cron == 1) { $contact_name = $row['contact_name']; $contact_email = $row['contact_email']; - 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"); + 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"); $subject = "Overdue Invoice $invoice_prefix$invoice_number"; $body = "Hello $contact_name,

According to our records, we have not received payment for invoice $invoice_prefix$invoice_number. Please submit your payment as soon as possible. If you have any questions please contact us at $company_phone. @@ -462,7 +462,7 @@ if ($config_enable_cron == 1) { 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"); + 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"); //Update recurring dates diff --git a/guest_view_invoice.php b/guest_view_invoice.php index 0fe8a96b..e64a7a06 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"); + 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"); } $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 c2fcf525..0dabc895 100644 --- a/guest_view_quote.php +++ b/guest_view_quote.php @@ -87,7 +87,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"); + 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"); } ?> diff --git a/top_nav.php b/top_nav.php index e3d3a5e9..cb781aff 100644 --- a/top_nav.php +++ b/top_nav.php @@ -55,9 +55,15 @@ $notification_type = htmlentities($row['notification_type']); $notification = htmlentities($row['notification']); $notification_timestamp = date('M d g:ia',strtotime($row['notification_timestamp'])); + $notification_client_id = intval($row['notification_client_id']); + if($notification_client_id > 0){ + $notification_link = "client_overview.php?client_id=$notification_client_id"; + } else { + $notification_link = "#"; + } ?> - +