From 3a048d71c450461525bc2f04829242457d831cef Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Wed, 26 Jun 2024 09:54:28 -0400 Subject: [PATCH 01/14] Added e-mail template editor E-mail template editor in Admin>Settings>Mail Subject lines to be added --- ajax.php | 10 ++- cron.php | 32 +++++++-- cron_ticket_email_parser.php | 12 +++- database_updates.php | 30 +++++++-- get_settings.php | 23 +++++++ guest_pay_invoice_stripe.php | 10 ++- portal/login_reset.php | 22 ++++++- post/contact.php | 10 ++- post/event.php | 22 ++++++- post/invoice.php | 67 ++++++++++++++++--- post/quote.php | 10 ++- post/setting.php | 59 +++++++++++++++++ post/ticket.php | 100 +++++++++++++++++++++++++---- settings_mail.php | 121 +++++++++++++++++++++++++++++++++++ 14 files changed, 484 insertions(+), 44 deletions(-) diff --git a/ajax.php b/ajax.php index 47011ac1d..50691e4b5 100644 --- a/ajax.php +++ b/ajax.php @@ -300,6 +300,14 @@ $config_ticket_from_email = sanitizeInput($config_ticket_from_email); $config_mail_from_name = sanitizeInput($config_mail_from_name); $config_mail_from_email = sanitizeInput($config_mail_from_email); + + // Get Email Template + $config_et_client_securelink = htmlspecialchars_decode($config_et_client_securelink); + $config_et_client_securelink = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_securelink); // Send user e-mail, if specified if(!empty($config_smtp_host) && filter_var($item_email, FILTER_VALIDATE_EMAIL)){ @@ -308,7 +316,7 @@ if ($item_expires_friendly == "never") { $subject = "$company_name secure link enclosed"; } - $body = "Hello,

$session_name from $company_name sent you a time sensitive secure link regarding \"$item_name\".

The link will expire in $item_expires_friendly and may only be viewed $item_view_limit times, before the link is destroyed.

Click here to access your secure content

--
$company_name - Support
$config_ticket_from_email
$company_phone"; + $body = "$config_et_client_securelink"; $data = [ [ diff --git a/cron.php b/cron.php index de0f44db5..3f5055490 100644 --- a/cron.php +++ b/cron.php @@ -429,10 +429,18 @@ $sql_ticket_reply = mysqli_query($mysqli, "SELECT ticket_reply FROM ticket_replies WHERE ticket_reply_type = 'Public' AND ticket_reply_ticket_id = $ticket_id ORDER BY ticket_reply_created_at DESC LIMIT 1"); $ticket_reply_row = mysqli_fetch_array($sql_ticket_reply); $ticket_reply = $ticket_reply_row['ticket_reply']; + + // Get Email Template + $config_et_client_ticket_autoclose = htmlspecialchars_decode($config_et_client_ticket_autoclose); + $config_et_client_ticket_autoclose = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_ticket_autoclose); $subject = "Ticket pending closure - [$ticket_prefix$ticket_number] - $ticket_subject"; - $body = "##- Please type your reply above this line -##

Hello, $contact_name

This is an automatic friendly reminder that your ticket regarding \"$ticket_subject\" will be closed, unless you respond.

--------------------------------
$ticket_reply--------------------------------

If your issue is resolved, you can ignore this email - the ticket will automatically close. If you need further assistance, please respond to this email.

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; + $body = "$config_et_client_ticket_autoclose"; $data = [ [ @@ -490,6 +498,14 @@ $client_name = sanitizeInput($row['client_name']); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); + + // Get Email Template + $config_et_client_invoice_paymentreminder = htmlspecialchars_decode($config_et_client_invoice_paymentreminder); + $config_et_client_invoice_paymentreminder = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_invoice_paymentreminder); // Late Charges @@ -513,9 +529,7 @@ 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 = "$company_name 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_email or $company_phone. -

- Kindly review the invoice details mentioned below.

Invoice: $invoice_prefix$invoice_number
Issue Date: $invoice_date
Total: " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . "
Due Date: $invoice_due
Over Due By: $day Days


To view your invoice, please click here.


--
$company_name - Billing
$config_invoice_from_email
$company_phone"; + $body = "$config_et_client_invoice_paymentreminder"; $mail = addToMailQueue($mysqli, [ [ @@ -632,9 +646,17 @@ $client_name = sanitizeInput($row['client_name']); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); + + // Get Email Template + $config_et_client_invoice_newrecurring = htmlspecialchars_decode($config_et_client_invoice_newrecurring); + $config_et_client_invoice_newrecurring = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_invoice_newrecurring); $subject = "$company_name Invoice $invoice_prefix$invoice_number"; - $body = "Hello $contact_name,

An invoice regarding \"$invoice_scope\" has been generated. Please view the details below.

Invoice: $invoice_prefix$invoice_number
Issue Date: $invoice_date
Total: " . numfmt_format_currency($currency_format, $invoice_amount, $recurring_currency_code) . "
Due Date: $invoice_due


To view your invoice, please click here.


--
$company_name - Billing
$config_invoice_from_email
$company_phone"; + $body = "$config_et_client_invoice_newrecurring"; $mail = addToMailQueue($mysqli, [ [ diff --git a/cron_ticket_email_parser.php b/cron_ticket_email_parser.php index 7984946b1..b2ae7acb0 100644 --- a/cron_ticket_email_parser.php +++ b/cron_ticket_email_parser.php @@ -137,9 +137,17 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date $data = []; if ($config_ticket_client_general_notifications == 1) { + // Get Email Template + $config_et_client_ticket_new = htmlspecialchars_decode($config_et_client_ticket_new); + $config_et_client_ticket_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_ticket_new); + $subject_email = "Ticket created - [$config_ticket_prefix$ticket_number] - $subject"; - $body = "##- Please type your reply above this line -##

Hello $contact_name,

Thank you for your email. A ticket regarding \"$subject\" has been automatically created for you.

Ticket: $config_ticket_prefix$ticket_number
Subject: $subject
Status: New
https://$config_base_url/portal/ticket.php?id=$id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; - + $body = "$config_et_client_ticket_new"; + $data[] = [ 'from' => $config_ticket_from_email, 'from_name' => $config_ticket_from_name, diff --git a/database_updates.php b/database_updates.php index 5fbd21c63..593029d24 100644 --- a/database_updates.php +++ b/database_updates.php @@ -2077,11 +2077,31 @@ mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.1'"); } - // if (CURRENT_DATABASE_VERSION == '1.4.1') { - // // Insert queries here required to update to DB version 1.4.2 - // // Then, update the database to the next sequential version - // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.2'"); - // } + if (CURRENT_DATABASE_VERSION == '1.4.1') { + mysqli_query($mysqli, "ALTER TABLE `settings` + ADD `config_et_client_ticket_new` TEXT, + ADD `config_et_client_ticket_update` TEXT, + ADD `config_et_client_ticket_autoclose` TEXT, + ADD `config_et_client_ticket_updatedpendingclosure` TEXT, + ADD `config_et_client_ticket_closed` TEXT, + ADD `config_et_client_app_newaccount` TEXT, + ADD `config_et_client_app_passwordreset` TEXT, + ADD `config_et_client_app_passwordresetcomplete` TEXT, + ADD `config_et_client_calendar_rescheduled` TEXT, + ADD `config_et_client_calendar_scheduled` TEXT, + ADD `config_et_client_invoice_new` TEXT, + ADD `config_et_client_invoice_newrecurring` TEXT, + ADD `config_et_client_invoice_paid` TEXT, + ADD `config_et_client_invoice_paymentfull` TEXT, + ADD `config_et_client_invoice_paymentmultiple` TEXT, + ADD `config_et_client_invoice_paymentpartial` TEXT, + ADD `config_et_client_invoice_paymentreminder` TEXT, + ADD `config_et_client_invoice_paymentstripe` TEXT, + ADD `config_et_client_quote_new` TEXT, + ADD `config_et_client_securelink` TEXT, + ADD `config_et_watcher_notify` TEXT"); + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.2'"); + } } else { // Up-to-date diff --git a/get_settings.php b/get_settings.php index e4d67fa9b..452cfc59b 100644 --- a/get_settings.php +++ b/get_settings.php @@ -25,6 +25,29 @@ $config_imap_encryption = $row['config_imap_encryption']; $config_imap_username = $row['config_imap_username']; $config_imap_password = $row['config_imap_password']; +// Mail - Email Templates +$config_et_client_ticket_new = $row['config_et_client_ticket_new']; +$config_et_client_ticket_update = $row['config_et_client_ticket_update']; +$config_et_client_ticket_autoclose = $row['config_et_client_ticket_autoclose']; +$config_et_client_ticket_updatedpendingclosure = $row['config_et_client_ticket_updatedpendingclosure']; +$config_et_client_ticket_closed = $row['config_et_client_ticket_closed']; +$config_et_client_app_newaccount = $row['config_et_client_app_newaccount']; +$config_et_client_app_passwordreset = $row['config_et_client_app_passwordreset']; +$config_et_client_app_passwordresetcomplete = $row['config_et_client_app_passwordresetcomplete']; +$config_et_client_calendar_rescheduled = $row['config_et_client_calendar_rescheduled']; +$config_et_client_calendar_scheduled = $row['config_et_client_calendar_scheduled']; +$config_et_client_invoice_new = $row['config_et_client_invoice_new']; +$config_et_client_invoice_newrecurring = $row['config_et_client_invoice_newrecurring']; +$config_et_client_invoice_paid = $row['config_et_client_invoice_paid']; +$config_et_client_invoice_paymentfull = $row['config_et_client_invoice_paymentfull']; +$config_et_client_invoice_paymentmultiple = $row['config_et_client_invoice_paymentmultiple']; +$config_et_client_invoice_paymentpartial = $row['config_et_client_invoice_paymentpartial']; +$config_et_client_invoice_paymentreminder = $row['config_et_client_invoice_paymentreminder']; +$config_et_client_invoice_paymentstripe = $row['config_et_client_invoice_paymentstripe']; +$config_et_client_quote_new = $row['config_et_client_quote_new']; +$config_et_client_securelink = $row['config_et_client_securelink']; +$config_et_watcher_notify = $row['config_et_watcher_notify']; + // Defaults $config_start_page = $row['config_start_page']; diff --git a/guest_pay_invoice_stripe.php b/guest_pay_invoice_stripe.php index 43c2b24a7..c971160f9 100644 --- a/guest_pay_invoice_stripe.php +++ b/guest_pay_invoice_stripe.php @@ -352,10 +352,18 @@ function log_to_console($message) { $config_invoice_from_email = sanitizeInput($row['config_invoice_from_email']); $config_base_url = sanitizeInput($config_base_url); + + // Get Email Template + $config_et_client_invoice_paymentstripe = htmlspecialchars_decode($config_et_client_invoice_paymentstripe); + $config_et_client_invoice_paymentstripe = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_invoice_paymentstripe); if (!empty($config_smtp_host)) { $subject = "Payment Received - Invoice $invoice_prefix$invoice_number"; - $body = "Hello $contact_name,

We have received your payment in the amount of " . $pi_currency . $pi_amount_paid . " for invoice $invoice_prefix$invoice_number. Please keep this email as a receipt for your records.

Amount: " . numfmt_format_currency($currency_format, $pi_amount_paid, $invoice_currency_code) . "
Balance: " . numfmt_format_currency($currency_format, '0', $invoice_currency_code) . "

Thank you for your business!


~
$company_name - Billing
$config_invoice_from_email
$company_phone"; + $body = "$config_et_client_invoice_paymentstripe"; $data = [ [ diff --git a/portal/login_reset.php b/portal/login_reset.php index 76e70fd68..b137fd055 100644 --- a/portal/login_reset.php +++ b/portal/login_reset.php @@ -78,9 +78,17 @@ mysqli_query($mysqli, "UPDATE contacts SET contact_password_reset_token = '$token' WHERE contact_id = $id LIMIT 1"); mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Modify', log_description = 'Sent a portal password reset e-mail for $email.', log_ip = '$ip', log_user_agent = '$user_agent', log_client_id = $client"); + // Get Email Template + $config_et_client_app_passwordreset = htmlspecialchars_decode($config_et_client_app_passwordreset); + $config_et_client_app_passwordreset = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_app_passwordreset); + // Send reset email $subject = "Password reset for $company_name Client Portal"; - $body = "Hello $name,

Someone (probably you) has requested a new password for your account on $company_name\'s Client Portal.

Please click here to reset your password.

Alternatively, copy and paste this URL into your browser:
$url

If you didn\'t request this change, you can safely ignore this email.

--
$company_name - Support
$config_ticket_from_email
$company_phone"; + $body = "$config_et_client_app_passwordreset"; $data = [ [ @@ -130,10 +138,18 @@ $password = password_hash($_POST['new_password'], PASSWORD_DEFAULT); mysqli_query($mysqli, "UPDATE contacts SET contact_password_hash = '$password', contact_password_reset_token = NULL WHERE contact_id = $contact_id LIMIT 1"); mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Modify', log_description = 'Reset portal password for $email.', log_ip = '$ip', log_user_agent = '$user_agent', log_client_id = $client"); - + + // Get Email Template + $config_et_client_app_passwordresetcomplete = htmlspecialchars_decode($config_et_client_app_passwordresetcomplete); + $config_et_client_app_passwordresetcomplete = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_app_passwordresetcomplete); + // Send confirmation email $subject = "Password reset confirmation for $company_name Client Portal"; - $body = "Hello $name,

Your password for your account on $company_name\'s Client Portal was successfully reset. You should be all set!

If you didn\'t reset your password, please get in touch ASAP.

--
$company_name - Support
$config_ticket_from_email
$company_phone"; + $body = "$config_et_client_app_passwordresetcomplete"; $data = [ diff --git a/post/contact.php b/post/contact.php index ad885da58..d33a4f3cd 100644 --- a/post/contact.php +++ b/post/contact.php @@ -149,9 +149,17 @@ } else { $password_info = mysqli_real_escape_string($mysqli, $_POST['contact_password'] . " -- Please change on first login"); } + + // Get Email Template + $config_et_client_app_newaccount = htmlspecialchars_decode($config_et_client_app_newaccount); + $config_et_client_app_newaccount = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_app_newaccount); $subject = "Your new $company_name portal account"; - $body = "Hello $name,

$company_name has created a support portal account for you.

Username: $email
Password: $password_info

Login URL: https://$config_base_url/portal/

--
$company_name - Support
$config_ticket_from_email
$company_phone"; + $body = "$config_et_client_app_newaccount"; // Queue Mail $data = [ diff --git a/post/event.php b/post/event.php index 786960b6a..c95354421 100644 --- a/post/event.php +++ b/post/event.php @@ -74,14 +74,22 @@ $company_email = sanitizeInput($row['company_email']); $company_website = sanitizeInput($row['company_website']); $company_logo = sanitizeInput($row['company_logo']); + + // Get Email Template + $config_et_client_calendar_scheduled = htmlspecialchars_decode($config_et_client_calendar_scheduled); + $config_et_client_calendar_scheduled = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_calendar_scheduled); // Sanitize Config Vars from get_settings.php and Session Vars from check_login.php $config_mail_from_name = sanitizeInput($config_mail_from_name); $config_mail_from_email = sanitizeInput($config_mail_from_email); $subject = "New Calendar Event"; - $body = "Hello $contact_name,

A calendar event has been scheduled:

Event Title: $title
Event Date: $start


--
$company_name
$company_phone"; - + $body = "$config_et_client_calendar_scheduled"; + $data = [ [ 'from' => $config_mail_from_email, @@ -144,13 +152,21 @@ $company_website = sanitizeInput($row['company_website']); $company_logo = sanitizeInput($row['company_logo']); + // Get Email Template + $config_et_client_calendar_rescheduled = htmlspecialchars_decode($config_et_client_calendar_rescheduled); + $config_et_client_calendar_rescheduled = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_calendar_rescheduled); + // Sanitize Config Vars from get_settings.php and Session Vars from check_login.php $config_mail_from_name = sanitizeInput($config_mail_from_name); $config_mail_from_email = sanitizeInput($config_mail_from_email); $subject = "Calendar Event Rescheduled"; - $body = "Hello $contact_name,

A calendar event has been rescheduled:

Event Title: $title
Event Date: $start


--
$company_name
$company_phone"; + $body = "$config_et_client_calendar_rescheduled"; $data = [ [ diff --git a/post/invoice.php b/post/invoice.php index 11e874c80..6fa5d680f 100644 --- a/post/invoice.php +++ b/post/invoice.php @@ -636,6 +636,7 @@ $invoice_number = intval($row['invoice_number']); $invoice_url_key = sanitizeInput($row['invoice_url_key']); $invoice_currency_code = sanitizeInput($row['invoice_currency_code']); + $invoice_date = sanitizeInput($row['invoice_date']); $client_id = intval($row['client_id']); $client_name = sanitizeInput($row['client_name']); $contact_name = sanitizeInput($row['contact_name']); @@ -673,9 +674,17 @@ $invoice_status = "Paid"; if ($email_receipt == 1) { - - $subject = "$company_name Payment Received - Invoice $invoice_prefix$invoice_number"; - $body = "Hello $contact_name,

We have received your payment in the amount of " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . " for invoice $invoice_prefix$invoice_number. Please keep this email as a receipt for your records.

Amount: " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . "
Balance: " . numfmt_format_currency($currency_format, $invoice_balance, $invoice_currency_code) . "

Thank you for your business!


--
$company_name - Billing Department
$config_invoice_from_email
$company_phone"; + + // Get Email Template + $config_et_client_invoice_paymentfull = htmlspecialchars_decode($config_et_client_invoice_paymentfull); + $config_et_client_invoice_paymentfull = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_invoice_paymentfull); + + $subject = "$company_name Payment Received - Invoice $invoice_prefix$invoice_number"; + $body = "$config_et_client_invoice_paymentfull"; // Queue Mail $email = [ @@ -706,8 +715,16 @@ if ($email_receipt == 1) { + // Get Email Template + $config_et_client_invoice_paymentpartial = htmlspecialchars_decode($config_et_client_invoice_paymentpartial); + $config_et_client_invoice_paymentpartial = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_invoice_paymentpartial); + $subject = "$company_name Partial Payment Received - Invoice $invoice_prefix$invoice_number"; - $body = "Hello $contact_name,

We have received partial payment in the amount of " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . " and it has been applied to invoice $invoice_prefix$invoice_number. Please keep this email as a receipt for your records.

Amount: " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . "
Balance: " . numfmt_format_currency($currency_format, $invoice_balance, $invoice_currency_code) . "

Thank you for your business!


~
$company_name - Billing
$config_invoice_from_email
$company_phone"; + $body = "$config_et_client_invoice_paymentpartial"; // Queue Mail $email = [ @@ -864,9 +881,17 @@ // Sanitize Config vars from get_settings.php $config_invoice_from_name = sanitizeInput($config_invoice_from_name); $config_invoice_from_email = sanitizeInput($config_invoice_from_email); + + // Get Email Template + $config_et_client_invoice_paymentmultiple = htmlspecialchars_decode($config_et_client_invoice_paymentmultiple); + $config_et_client_invoice_paymentmultiple = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_invoice_paymentmultiple); $subject = "Payment Received - Multiple Invoices"; - $body = "Hello $contact_name,

Thank you for your payment of " . numfmt_format_currency($currency_format, $bulk_payment_amount_static, $currency_code) . " We\'ve applied your payment to the following invoices, updating their balances accordingly:

$email_body_invoices


We appreciate your continued business!

Sincerely,
$company_name - Billing
$config_invoice_from_email
$company_phone"; + $body = "$config_et_client_invoice_paymentmultiple"; // Queue Mail mysqli_query($mysqli, "INSERT INTO email_queue SET email_recipient = '$contact_email', email_recipient_name = '$contact_name', email_from = '$config_invoice_from_email', email_from_name = '$config_invoice_from_name', email_subject = '$subject', email_content = '$body'"); @@ -989,11 +1014,29 @@ $balance = $invoice_amount - $amount_paid; if ($invoice_status == 'Paid') { + + // Get Email Template + $config_et_client_invoice_paid = htmlspecialchars_decode($config_et_client_invoice_paid); + $config_et_client_invoice_paid = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_invoice_paid); + $subject = "$company_name Invoice $invoice_prefix$invoice_number Receipt"; - $body = "Hello $contact_name,

Please click on the link below to see your invoice regarding \"$invoice_scope\" marked paid.

Invoice Link


--
$company_name - Billing
$config_invoice_from_email
$company_phone"; + $body = "$config_et_client_invoice_paid"; } else { + + // Get Email Template + $config_et_client_invoice_new = htmlspecialchars_decode($config_et_client_invoice_new); + $config_et_client_invoice_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_invoice_new); + $subject = "$company_name Invoice $invoice_prefix$invoice_number"; - $body = "Hello $contact_name,

Please view the details of your invoice regarding \"$invoice_scope\" below.

Invoice: $invoice_prefix$invoice_number
Issue Date: $invoice_date
Total: " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . "
Balance Due: " . numfmt_format_currency($currency_format, $balance, $invoice_currency_code) . "
Due Date: $invoice_due


To view your invoice, please click here.


--
$company_name - Billing
$config_invoice_from_email
$company_phone"; + $body = "$config_et_client_invoice_new"; } // Queue Mail @@ -1169,11 +1212,19 @@ // Sanitize Config Vars $config_invoice_from_email = sanitizeInput($config_invoice_from_email); $config_invoice_from_name = sanitizeInput($config_invoice_from_name); + + // Get Email Template + $config_et_client_invoice_newrecurring = htmlspecialchars_decode($config_et_client_invoice_newrecurring); + $config_et_client_invoice_newrecurring = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_invoice_newrecurring); // Email to client $subject = "$company_name Invoice $invoice_prefix$invoice_number"; - $body = "Hello $contact_name,

An invoice regarding \"$invoice_scope\" has been generated. Please view the details below.

Invoice: $invoice_prefix$invoice_number
Issue Date: $invoice_date
Total: $$invoice_amount
Due Date: $invoice_due


To view your invoice, please click here.


--
$company_name - Billing
$company_phone"; + $body = "$config_et_client_invoice_newrecurring"; $data = [ diff --git a/post/quote.php b/post/quote.php index 94c055d22..05eb9cc5d 100644 --- a/post/quote.php +++ b/post/quote.php @@ -389,9 +389,17 @@ $config_quote_from_name = sanitizeInput($config_quote_from_name); $config_quote_from_email = sanitizeInput($config_quote_from_email); $config_base_url = sanitizeInput($config_base_url); + + // Get Email Template + $config_et_client_quote_new = htmlspecialchars_decode($config_et_client_quote_new); + $config_et_client_quote_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_quote_new); $subject = "Quote [$quote_scope]"; - $body = "Hello $contact_name,

Thank you for your inquiry, we are pleased to provide you with the following estimate.


$quote_scope
Total Cost: " . numfmt_format_currency($currency_format, $quote_amount, $quote_currency_code) . "


View and accept your estimate online here


--
$company_name - Sales
$config_quote_from_email
$company_phone"; + $body = "$config_et_client_quote_new"; // Queue Mail $data = [ diff --git a/post/setting.php b/post/setting.php index 60d7625a6..6a5a4d639 100644 --- a/post/setting.php +++ b/post/setting.php @@ -215,6 +215,65 @@ } +// Email templates +if (isset($_POST['edit_mail_email_template'])) { + + validateCSRFToken($_POST['csrf_token']); + validateAdminRole(); + + $config_et_client_ticket_new = sanitizeForEmail($_POST['config_et_client_ticket_new']); + $config_et_client_ticket_update = sanitizeForEmail($_POST['config_et_client_ticket_update']); + $config_et_client_ticket_autoclose = sanitizeForEmail($_POST['config_et_client_ticket_autoclose']); + $config_et_client_ticket_updatedpendingclosure = sanitizeForEmail($_POST['config_et_client_ticket_updatedpendingclosure']); + $config_et_client_ticket_closed = sanitizeForEmail($_POST['config_et_client_ticket_closed']); + $config_et_client_app_newaccount = sanitizeForEmail($_POST['config_et_client_app_newaccount']); + $config_et_client_app_passwordreset = sanitizeForEmail($_POST['config_et_client_app_passwordreset']); + $config_et_client_app_passwordresetcomplete = sanitizeForEmail($_POST['config_et_client_app_passwordresetcomplete']); + $config_et_client_calendar_rescheduled = sanitizeForEmail($_POST['config_et_client_calendar_rescheduled']); + $config_et_client_calendar_scheduled = sanitizeForEmail($_POST['config_et_client_calendar_scheduled']); + $config_et_client_invoice_new = sanitizeForEmail($_POST['config_et_client_invoice_new']); + $config_et_client_invoice_newrecurring = sanitizeForEmail($_POST['config_et_client_invoice_newrecurring']); + $config_et_client_invoice_paid = sanitizeForEmail($_POST['config_et_client_invoice_paid']); + $config_et_client_invoice_paymentfull = sanitizeForEmail($_POST['config_et_client_invoice_paymentfull']); + $config_et_client_invoice_paymentmultiple = sanitizeForEmail($_POST['config_et_client_invoice_paymentmultiple']); + $config_et_client_invoice_paymentpartial = sanitizeForEmail($_POST['config_et_client_invoice_paymentpartial']); + $config_et_client_invoice_paymentreminder = sanitizeForEmail($_POST['config_et_client_invoice_paymentreminder']); + $config_et_client_invoice_paymentstripe = sanitizeForEmail($_POST['config_et_client_invoice_paymentstripe']); + $config_et_client_quote_new = sanitizeForEmail($_POST['config_et_client_quote_new']); + $config_et_client_securelink = sanitizeForEmail($_POST['config_et_client_securelink']); + $config_et_watcher_notify = sanitizeForEmail($_POST['config_et_watcher_notify']); + + mysqli_query($mysqli, "UPDATE settings SET + config_et_client_ticket_new = '$config_et_client_ticket_new', + config_et_client_ticket_update = '$config_et_client_ticket_update', + config_et_client_ticket_autoclose = '$config_et_client_ticket_autoclose', + config_et_client_ticket_updatedpendingclosure = '$config_et_client_ticket_updatedpendingclosure', + config_et_client_ticket_closed = '$config_et_client_ticket_closed', + config_et_client_app_newaccount = '$config_et_client_app_newaccount', + config_et_client_app_passwordreset = '$config_et_client_app_passwordreset', + config_et_client_app_passwordresetcomplete = '$config_et_client_app_passwordresetcomplete', + config_et_client_calendar_rescheduled = '$config_et_client_calendar_rescheduled', + config_et_client_calendar_scheduled = '$config_et_client_calendar_scheduled', + config_et_client_invoice_new = '$config_et_client_invoice_new', + config_et_client_invoice_newrecurring = '$config_et_client_invoice_newrecurring', + config_et_client_invoice_paid = '$config_et_client_invoice_paid', + config_et_client_invoice_paymentfull = '$config_et_client_invoice_paymentfull', + config_et_client_invoice_paymentmultiple = '$config_et_client_invoice_paymentmultiple', + config_et_client_invoice_paymentpartial = '$config_et_client_invoice_paymentpartial', + config_et_client_invoice_paymentreminder = '$config_et_client_invoice_paymentreminder', + config_et_client_invoice_paymentstripe = '$config_et_client_invoice_paymentstripe', + config_et_client_quote_new = '$config_et_client_quote_new', + config_et_client_securelink = '$config_et_client_securelink', + config_et_watcher_notify = '$config_et_watcher_notify' + WHERE company_id = 1"); + + + $_SESSION['alert_message'] = "Email Template updated"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} + if (isset($_POST['edit_invoice_settings'])) { validateCSRFToken($_POST['csrf_token']); diff --git a/post/ticket.php b/post/ticket.php index 0ff1d3ae2..0ac9f11ef 100644 --- a/post/ticket.php +++ b/post/ticket.php @@ -26,6 +26,7 @@ $project_id = intval($_POST['project']); $use_primary_contact = intval($_POST['use_primary_contact']); $ticket_template_id = intval($_POST['ticket_template_id']); + $config_et_client_ticket_update = $row['config_et_client_ticket_update']; // Check to see if adding a ticket by template if($ticket_template_id) { @@ -133,12 +134,20 @@ $row = mysqli_fetch_array($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); + + // Get Email Template + $config_et_client_ticket_new = htmlspecialchars_decode($config_et_client_ticket_new); + $config_et_client_ticket_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_ticket_new); // Verify contact email is valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { $subject = "Ticket created [$ticket_prefix$ticket_number] - $ticket_subject"; - $body = "##- Please type your reply above this line -##

Hello $contact_name,

A ticket regarding \"$ticket_subject\" has been created for you.

--------------------------------
$ticket_details--------------------------------

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: Open
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; + $body = "$config_et_client_ticket_new"; // Email Ticket Contact // Queue Mail @@ -233,13 +242,20 @@ $row = mysqli_fetch_array($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); + + // Get Email Template + $config_et_client_ticket_new = htmlspecialchars_decode($config_et_client_ticket_new); + $config_et_client_ticket_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_ticket_new); // Email content $data = []; // Queue array $subject = "Ticket Created - [$ticket_prefix$ticket_number] - $ticket_subject"; - $body = "##- Please type your reply above this line -##

Hello $contact_name,

A ticket regarding \"$ticket_subject\" has been created for you.

--------------------------------
$ticket_details--------------------------------

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; - + $body = "$config_et_client_ticket_new"; // Only add contact to email queue if email is valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { @@ -324,13 +340,20 @@ $row = mysqli_fetch_array($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); + + // Get Email Template + $config_et_client_ticket_new = htmlspecialchars_decode($config_et_client_ticket_new); + $config_et_client_ticket_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_ticket_new); // Email content $data = []; // Queue array $subject = "Ticket Created - [$ticket_prefix$ticket_number] - $ticket_subject"; - $body = "##- Please type your reply above this line -##

Hello $contact_name,

A ticket regarding \"$ticket_subject\" has been created for you.

--------------------------------
$ticket_details--------------------------------

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; - + $body = "$config_et_client_ticket_new"; // Only add contact to email queue if email is valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { @@ -395,13 +418,21 @@ $row = mysqli_fetch_array($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); + + // Get Email Template + $config_et_watcher_notify = htmlspecialchars_decode($config_et_watcher_notify); + $config_et_watcher_notify = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_watcher_notify); + // Email content $data = []; // Queue array $subject = "Ticket Notification - [$ticket_prefix$ticket_number] - $ticket_subject"; - $body = "##- Please type your reply above this line -##

Hello,

You are now a watcher on a ticket regarding \"$ticket_subject\".

--------------------------------
$ticket_details--------------------------------

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; - + $body = "$config_et_watcher_notify"; // Only add watcher to email queue if email is valid if (filter_var($watcher_email, FILTER_VALIDATE_EMAIL)) { @@ -863,6 +894,14 @@ $row = mysqli_fetch_array($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); + + // Get Email Template + $config_et_client_ticket_closed = htmlspecialchars_decode($config_et_client_ticket_closed); + $config_et_client_ticket_closed = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_ticket_closed); // Check email valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { @@ -870,8 +909,8 @@ $data = []; $subject = "Ticket closed - [$ticket_prefix$ticket_number] - $ticket_subject | (do not reply)"; - $body = "Hello $contact_name,

Your ticket regarding \"$ticket_subject\" has been closed.

$details

We hope the request/issue was resolved to your satisfaction. If you need further assistance, please raise a new ticket using the below details. Please do not reply to this email.

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Portal: https://$base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; - + $body = "$config_et_client_ticket_closed"; + // Email Ticket Contact // Queue Mail @@ -980,6 +1019,14 @@ $row = mysqli_fetch_array($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); + + // Get Email Template + $config_et_client_ticket_update = htmlspecialchars_decode($config_et_client_ticket_update); + $config_et_client_ticket_update = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_ticket_update); // Send e-mail to client if public update & email is set up if ($private_note == 0 && !empty($config_smtp_host)) { @@ -987,7 +1034,7 @@ if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject"; - $body = "##- Please type your reply above this line -##

Hello $contact_name,

Your ticket regarding $ticket_subject has been updated.

--------------------------------
$ticket_reply
--------------------------------

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status_name
Portal: https://$base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$from_email
$company_phone"; + $body = "$config_et_client_ticket_update"; $data = []; @@ -1160,7 +1207,24 @@ $row = mysqli_fetch_array($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); - + + // Get Email Template AutoClose + $config_et_client_ticket_autoclose = htmlspecialchars_decode($config_et_client_ticket_autoclose); + $config_et_client_ticket_autoclose = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_ticket_autoclose); + + // Get Email Template Update + $config_et_client_ticket_update = htmlspecialchars_decode($config_et_client_ticket_update); + $config_et_client_ticket_update = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_ticket_update); + + // Send e-mail to client if public update & email is set up if ($ticket_reply_type == 'Public' && $send_email == 1 && !empty($config_smtp_host)) { @@ -1171,11 +1235,11 @@ if ($ticket_status == 4) { // Auto-close $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject | (pending closure)"; - $body = "##- Please type your reply above this line -##

Hello $contact_name,

Your ticket regarding $ticket_subject has been updated and is pending closure.

--------------------------------
$ticket_reply
--------------------------------

If your request/issue is resolved, you can simply ignore this email. If you need further assistance, please respond to let us know!

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status_name
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; + $body = "$config_et_client_ticket_autoclose"; } else { // Anything else $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject"; - $body = "##- Please type your reply above this line -##

Hello $contact_name,

Your ticket regarding $ticket_subject has been updated.

--------------------------------
$ticket_reply
--------------------------------

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Status: $ticket_status_name
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; + $body = "$config_et_client_ticket_update"; } $data = []; @@ -1397,6 +1461,14 @@ $row = mysqli_fetch_array($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); + + // Get Email Template + $config_et_client_ticket_closed = htmlspecialchars_decode($config_et_client_ticket_closed); + $config_et_client_ticket_closed = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $config_et_client_ticket_closed); // Check email valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { @@ -1404,7 +1476,7 @@ $data = []; $subject = "Ticket closed - [$ticket_prefix$ticket_number] - $ticket_subject | (do not reply)"; - $body = "Hello $contact_name,

Your ticket regarding \"$ticket_subject\" has been closed.

We hope the request/issue was resolved to your satisfaction. If you need further assistance, please raise a new ticket using the below details. Please do not reply to this email.

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; + $body = "$config_et_client_ticket_closed"; // Email Ticket Contact // Queue Mail diff --git a/settings_mail.php b/settings_mail.php index dde100eec..ca248fad5 100644 --- a/settings_mail.php +++ b/settings_mail.php @@ -326,6 +326,127 @@ + +
+
+

Email Template Editor

+
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + +
+ + + +
+
+ Date: Wed, 26 Jun 2024 10:26:28 -0400 Subject: [PATCH 02/14] Create db-email-templates.sql --- db-email-templates.sql | 151 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 db-email-templates.sql diff --git a/db-email-templates.sql b/db-email-templates.sql new file mode 100644 index 000000000..7023cd402 --- /dev/null +++ b/db-email-templates.sql @@ -0,0 +1,151 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.1 +-- https://www.phpmyadmin.net/ +-- +-- Host: 127.0.0.1:3306 +-- Generation Time: Jun 26, 2024 at 02:24 PM +-- Server version: 8.3.0 +-- PHP Version: 8.2.18 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `itflow` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `settings` +-- + +DROP TABLE IF EXISTS `settings`; +CREATE TABLE IF NOT EXISTS `settings` ( + `company_id` int NOT NULL, + `config_current_database_version` varchar(10) COLLATE utf8mb4_general_ci NOT NULL, + `config_start_page` varchar(200) COLLATE utf8mb4_general_ci DEFAULT 'clients.php', + `config_smtp_host` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_smtp_port` int DEFAULT NULL, + `config_smtp_encryption` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_smtp_username` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_smtp_password` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_mail_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_mail_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_imap_host` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_imap_port` int DEFAULT NULL, + `config_imap_encryption` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_imap_username` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_imap_password` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_et_client_ticket_new` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_update` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_autoclose` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_updatedpendingclosure` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_closed` text COLLATE utf8mb4_general_ci, + `config_default_transfer_from_account` int DEFAULT NULL, + `config_default_transfer_to_account` int DEFAULT NULL, + `config_default_payment_account` int DEFAULT NULL, + `config_default_expense_account` int DEFAULT NULL, + `config_default_payment_method` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_default_expense_payment_method` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_default_calendar` int DEFAULT NULL, + `config_default_net_terms` int DEFAULT NULL, + `config_default_hourly_rate` decimal(15,2) NOT NULL DEFAULT '0.00', + `config_project_prefix` varchar(200) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'PRJ-', + `config_project_next_number` int NOT NULL DEFAULT '1', + `config_invoice_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_invoice_next_number` int DEFAULT NULL, + `config_invoice_footer` text COLLATE utf8mb4_general_ci, + `config_invoice_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_invoice_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_invoice_late_fee_enable` tinyint(1) NOT NULL DEFAULT '0', + `config_invoice_late_fee_percent` decimal(5,2) NOT NULL DEFAULT '0.00', + `config_recurring_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_recurring_next_number` int NOT NULL, + `config_quote_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_quote_next_number` int DEFAULT NULL, + `config_quote_footer` text COLLATE utf8mb4_general_ci, + `config_quote_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_quote_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ticket_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ticket_next_number` int DEFAULT NULL, + `config_ticket_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ticket_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ticket_email_parse` tinyint(1) NOT NULL DEFAULT '0', + `config_ticket_client_general_notifications` tinyint(1) NOT NULL DEFAULT '1', + `config_ticket_autoclose` tinyint(1) NOT NULL DEFAULT '0', + `config_ticket_autoclose_hours` int NOT NULL DEFAULT '72', + `config_ticket_new_ticket_notification_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ticket_default_billable` tinyint(1) NOT NULL DEFAULT '0', + `config_enable_cron` tinyint(1) NOT NULL DEFAULT '0', + `config_cron_key` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_recurring_auto_send_invoice` tinyint(1) NOT NULL DEFAULT '1', + `config_enable_alert_domain_expire` tinyint(1) NOT NULL DEFAULT '1', + `config_send_invoice_reminders` tinyint(1) NOT NULL DEFAULT '1', + `config_invoice_overdue_reminders` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_stripe_enable` tinyint(1) NOT NULL DEFAULT '0', + `config_stripe_publishable` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_stripe_secret` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_stripe_account` int NOT NULL DEFAULT '0', + `config_stripe_expense_vendor` int NOT NULL DEFAULT '0', + `config_stripe_expense_category` int NOT NULL DEFAULT '0', + `config_stripe_percentage_fee` decimal(4,4) NOT NULL DEFAULT '0.0290', + `config_ai_enable` tinyint(1) DEFAULT '0', + `config_ai_provider` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ai_model` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ai_url` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ai_api_key` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_stripe_flat_fee` decimal(15,2) NOT NULL DEFAULT '0.30', + `config_stripe_client_pays_fees` tinyint(1) NOT NULL DEFAULT '0', + `config_azure_client_id` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_azure_client_secret` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_module_enable_itdoc` tinyint(1) NOT NULL DEFAULT '1', + `config_module_enable_accounting` tinyint(1) NOT NULL DEFAULT '1', + `config_client_portal_enable` tinyint(1) NOT NULL DEFAULT '1', + `config_login_message` text COLLATE utf8mb4_general_ci, + `config_login_key_required` tinyint(1) NOT NULL DEFAULT '0', + `config_login_key_secret` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_login_remember_me_expire` int NOT NULL DEFAULT '3', + `config_module_enable_ticketing` tinyint(1) NOT NULL DEFAULT '1', + `config_theme` varchar(200) COLLATE utf8mb4_general_ci DEFAULT 'blue', + `config_telemetry` tinyint(1) DEFAULT '0', + `config_timezone` varchar(200) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'America/New_York', + `config_destructive_deletes_enable` tinyint(1) NOT NULL DEFAULT '0', + `config_phone_mask` tinyint(1) NOT NULL DEFAULT '1', + `config_et_client_app_newaccount` text COLLATE utf8mb4_general_ci, + `config_et_client_app_passwordreset` text COLLATE utf8mb4_general_ci, + `config_et_client_app_passwordresetcomplete` text COLLATE utf8mb4_general_ci, + `config_et_client_calendar_rescheduled` text COLLATE utf8mb4_general_ci, + `config_et_client_calendar_scheduled` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_new` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_newrecurring` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentfull` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentmultiple` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentpartial` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentreminder` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentstripe` text COLLATE utf8mb4_general_ci, + `config_et_client_quote_new` text COLLATE utf8mb4_general_ci, + `config_et_client_securelink` text COLLATE utf8mb4_general_ci, + `config_et_watcher_notify` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paid` text COLLATE utf8mb4_general_ci, + PRIMARY KEY (`company_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `settings` +-- + +INSERT INTO `settings` (`config_et_client_ticket_new`, `config_et_client_ticket_update`, `config_et_client_ticket_autoclose`, `config_et_client_ticket_updatedpendingclosure`, `config_et_client_ticket_closed`, `config_et_client_app_newaccount`, `config_et_client_app_passwordreset`, `config_et_client_app_passwordresetcomplete`, `config_et_client_calendar_rescheduled`, `config_et_client_calendar_scheduled`, `config_et_client_invoice_new`, `config_et_client_invoice_newrecurring`, `config_et_client_invoice_paymentfull`, `config_et_client_invoice_paymentmultiple`, `config_et_client_invoice_paymentpartial`, `config_et_client_invoice_paymentreminder`, `config_et_client_invoice_paymentstripe`, `config_et_client_quote_new`, `config_et_client_securelink`, `config_et_watcher_notify`, `config_et_client_invoice_paid`) VALUES +('<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>New Ticket Created</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name]<br><br><br>If you would like to check the status of your ticket or provide additional information, please respond to this notification.<br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>Ticket Updated</strong><br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Response:</strong> <br><br>[ticket_reply] <br><br><br>If you would like to check the status of your ticket or provide additional information, please respond to this notification <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>Ticket automatic closure notice</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Message:</strong> <br><br>This is an automatic reminder that your ticket will be closed unless you respond. <br>If your issue has been resolved, you can ignore this email and your ticket will close automatically. <br>If you need further assistance with this ticket, please respond to this email. <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>Ticket Updated</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Ticket Pending Closure</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Response:</strong> <br><br>[ticket_reply] <br><br><br>If your issue has been resolved, you can ignore this email and your ticket will close automatically. <br>If you need further assistance with this ticket, please respond to this email. <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>Ticket Closed</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br>Your ticket has been closed. We hope to have fixed your issue.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;<br><strong>Replies to this email will not be received</strong> <br>If you need further assistance, please open a new ticket. <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Account Created</strong><br><br><br><strong>Username:</strong> [username]<br><br><strong>Temporary Password:</strong> [password_info]&nbsp;<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Portal Link :</strong> &nbsp;<a href="https://[config_base_url]/portal/">https://[config_base_url]/portal/</a><br><br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Password Reset Request</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Please <a href="[url]">click here</a> to reset your password.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">If you did not request a password reset, ignore this email.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Password Reset Notification</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Your password for our Support Portal has been reset successfully.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">If you did not request a password reset, please get in touch with us immediately.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br><br>Thank You, <br>[company_name]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[company_phone]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Appointment Rescheduled</strong><br><br><br><strong>Title:</strong> [title]<br><br><strong>Appointment Date:</strong> [start]&nbsp;<br><br><strong>Contact:</strong> [contact_name] <br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Appointment Scheduled</strong><br><br><br><strong>Title:</strong> [title]<br><br><strong>Appointment Date:</strong> [start]&nbsp;<br><br><strong>Contact:</strong> [contact_name] <br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice from [company_name]</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Title:&nbsp;</strong>[invoice_scope]<br><br><strong>Invoice Date:</strong> [invoice_date]&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date:&nbsp;</strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>New Invoice</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Title:&nbsp;</strong>[invoice_scope]<br><br><strong>Invoice Date:</strong> [invoice_date]&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date:&nbsp;</strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[new_invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payment Received</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[total_payments_amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[invoice_balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payments Received</strong><br><br><br><strong>Payment Details:</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[email_body_invoices]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Partial Payment Received</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[invoice_balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Unpaid Invoice Reminder</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]&nbsp;<br><br><strong>Invoice Date:</strong> [invoice_date]&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date:&nbsp;</strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Our records indicate that we have not yet received payment for this invoice. We kindly request that you submit your payment as soon as possible.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">To view your invoice, please&nbsp;<a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payment Received</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> [pi_currency][pi_amount_paid]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>New Quote</strong><br><br><br><strong>Title:</strong> [quote_scope]&nbsp;<br><br><strong>Total Amount:</strong> $[quote_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view and accept your quote, please&nbsp;<a href="https://[config_base_url]/guest_view_quote.php?quote_id=[quote_id]&amp;url_key=[quote_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Please contact us with any questions or concerns.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[session_name] from [company name] has shared a secure link with you</strong><br><br><br><strong>Expires In:</strong> [item_expires_friendly]<br><br><strong>View Count Limit:</strong> [item_view_limit]&nbsp;<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Link :</strong> <a href="[url]">Click Here</a>&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>After the expiration time the above link will no longer work. You may want to record the linked content elsewhere, such as a password manager.&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>Ticket Watcher Notification</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">You are now a Watcher on this ticket.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Ticket Details:</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[ticket_details]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Paid</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[amount_paid]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[new_invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>'); +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; From 73046dd25289df3f841a022bfd416074b22e0149 Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Wed, 26 Jun 2024 13:55:09 -0400 Subject: [PATCH 03/14] Created prepareEmailTemplate function --- ajax.php | 7 +--- cron.php | 21 ++-------- cron_ticket_email_parser.php | 8 +--- functions.php | 14 ++++++- guest_pay_invoice_stripe.php | 7 +--- portal/login_reset.php | 14 +------ post/contact.php | 7 +--- post/event.php | 14 +------ post/invoice.php | 44 ++++----------------- post/quote.php | 7 +--- post/ticket.php | 74 ++++++++---------------------------- 11 files changed, 48 insertions(+), 169 deletions(-) diff --git a/ajax.php b/ajax.php index 50691e4b5..e8a38e4b7 100644 --- a/ajax.php +++ b/ajax.php @@ -302,12 +302,7 @@ $config_mail_from_email = sanitizeInput($config_mail_from_email); // Get Email Template - $config_et_client_securelink = htmlspecialchars_decode($config_et_client_securelink); - $config_et_client_securelink = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_securelink); + $config_et_client_securelink = prepareEmailTemplate($config_et_client_securelink); // Send user e-mail, if specified if(!empty($config_smtp_host) && filter_var($item_email, FILTER_VALIDATE_EMAIL)){ diff --git a/cron.php b/cron.php index 3f5055490..38ef0718d 100644 --- a/cron.php +++ b/cron.php @@ -431,12 +431,7 @@ $ticket_reply = $ticket_reply_row['ticket_reply']; // Get Email Template - $config_et_client_ticket_autoclose = htmlspecialchars_decode($config_et_client_ticket_autoclose); - $config_et_client_ticket_autoclose = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_ticket_autoclose); + $config_et_client_ticket_autoclose = prepareEmailTemplate($config_et_client_ticket_autoclose); $subject = "Ticket pending closure - [$ticket_prefix$ticket_number] - $ticket_subject"; @@ -500,12 +495,7 @@ $contact_email = sanitizeInput($row['contact_email']); // Get Email Template - $config_et_client_invoice_paymentreminder = htmlspecialchars_decode($config_et_client_invoice_paymentreminder); - $config_et_client_invoice_paymentreminder = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_invoice_paymentreminder); + $config_et_client_invoice_paymentreminder = prepareEmailTemplate($config_et_client_invoice_paymentreminder); // Late Charges @@ -648,12 +638,7 @@ $contact_email = sanitizeInput($row['contact_email']); // Get Email Template - $config_et_client_invoice_newrecurring = htmlspecialchars_decode($config_et_client_invoice_newrecurring); - $config_et_client_invoice_newrecurring = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_invoice_newrecurring); + $config_et_client_invoice_newrecurring = prepareEmailTemplate($config_et_client_invoice_newrecurring); $subject = "$company_name Invoice $invoice_prefix$invoice_number"; $body = "$config_et_client_invoice_newrecurring"; diff --git a/cron_ticket_email_parser.php b/cron_ticket_email_parser.php index 397dca9aa..12919b413 100644 --- a/cron_ticket_email_parser.php +++ b/cron_ticket_email_parser.php @@ -127,13 +127,9 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date $data = []; if ($config_ticket_client_general_notifications == 1) { + // Get Email Template - $config_et_client_ticket_new = htmlspecialchars_decode($config_et_client_ticket_new); - $config_et_client_ticket_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_ticket_new); + $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new); $subject_email = "Ticket created - [$config_ticket_prefix$ticket_number] - $subject"; $body = "$config_et_client_ticket_new"; diff --git a/functions.php b/functions.php index ae532c05d..780308b36 100644 --- a/functions.php +++ b/functions.php @@ -730,12 +730,24 @@ function sanitizeInput($input) function sanitizeForEmail($data) { - $sanitized = htmlspecialchars($data); + $sanitized = htmlspecialchars($data, ENT_QUOTES); $sanitized = strip_tags($sanitized); $sanitized = trim($sanitized); return $sanitized; } +function prepareEmailTemplate($emailtemplate) +{ + $emailtemplate = htmlspecialchars_decode($emailtemplate, ENT_QUOTES); + $emailtemplate = str_replace("'", "\'", $emailtemplate); + $emailtemplate = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $emailtemplate); + return $emailtemplate; +} + function timeAgo($datetime) { $time = strtotime($datetime); diff --git a/guest_pay_invoice_stripe.php b/guest_pay_invoice_stripe.php index c971160f9..44b878c5a 100644 --- a/guest_pay_invoice_stripe.php +++ b/guest_pay_invoice_stripe.php @@ -354,12 +354,7 @@ function log_to_console($message) { $config_base_url = sanitizeInput($config_base_url); // Get Email Template - $config_et_client_invoice_paymentstripe = htmlspecialchars_decode($config_et_client_invoice_paymentstripe); - $config_et_client_invoice_paymentstripe = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_invoice_paymentstripe); + $config_et_client_invoice_paymentstripe = prepareEmailTemplate($config_et_client_invoice_paymentstripe); if (!empty($config_smtp_host)) { $subject = "Payment Received - Invoice $invoice_prefix$invoice_number"; diff --git a/portal/login_reset.php b/portal/login_reset.php index b137fd055..8b6e28d60 100644 --- a/portal/login_reset.php +++ b/portal/login_reset.php @@ -79,12 +79,7 @@ mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Modify', log_description = 'Sent a portal password reset e-mail for $email.', log_ip = '$ip', log_user_agent = '$user_agent', log_client_id = $client"); // Get Email Template - $config_et_client_app_passwordreset = htmlspecialchars_decode($config_et_client_app_passwordreset); - $config_et_client_app_passwordreset = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_app_passwordreset); + $config_et_client_app_passwordreset = prepareEmailTemplate($config_et_client_app_passwordreset); // Send reset email $subject = "Password reset for $company_name Client Portal"; @@ -140,12 +135,7 @@ mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Modify', log_description = 'Reset portal password for $email.', log_ip = '$ip', log_user_agent = '$user_agent', log_client_id = $client"); // Get Email Template - $config_et_client_app_passwordresetcomplete = htmlspecialchars_decode($config_et_client_app_passwordresetcomplete); - $config_et_client_app_passwordresetcomplete = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_app_passwordresetcomplete); + $config_et_client_app_passwordresetcomplete = prepareEmailTemplate($config_et_client_app_passwordresetcomplete); // Send confirmation email $subject = "Password reset confirmation for $company_name Client Portal"; diff --git a/post/contact.php b/post/contact.php index d33a4f3cd..afa75e051 100644 --- a/post/contact.php +++ b/post/contact.php @@ -151,12 +151,7 @@ } // Get Email Template - $config_et_client_app_newaccount = htmlspecialchars_decode($config_et_client_app_newaccount); - $config_et_client_app_newaccount = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_app_newaccount); + $config_et_client_app_newaccount = prepareEmailTemplate($config_et_client_app_newaccount); $subject = "Your new $company_name portal account"; $body = "$config_et_client_app_newaccount"; diff --git a/post/event.php b/post/event.php index c95354421..288cdd551 100644 --- a/post/event.php +++ b/post/event.php @@ -76,12 +76,7 @@ $company_logo = sanitizeInput($row['company_logo']); // Get Email Template - $config_et_client_calendar_scheduled = htmlspecialchars_decode($config_et_client_calendar_scheduled); - $config_et_client_calendar_scheduled = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_calendar_scheduled); + $config_et_client_calendar_scheduled = prepareEmailTemplate($config_et_client_calendar_scheduled); // Sanitize Config Vars from get_settings.php and Session Vars from check_login.php $config_mail_from_name = sanitizeInput($config_mail_from_name); @@ -153,12 +148,7 @@ $company_logo = sanitizeInput($row['company_logo']); // Get Email Template - $config_et_client_calendar_rescheduled = htmlspecialchars_decode($config_et_client_calendar_rescheduled); - $config_et_client_calendar_rescheduled = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_calendar_rescheduled); + $config_et_client_calendar_rescheduled = prepareEmailTemplate($config_et_client_calendar_rescheduled); // Sanitize Config Vars from get_settings.php and Session Vars from check_login.php $config_mail_from_name = sanitizeInput($config_mail_from_name); diff --git a/post/invoice.php b/post/invoice.php index 6fa5d680f..986ee0643 100644 --- a/post/invoice.php +++ b/post/invoice.php @@ -676,12 +676,7 @@ if ($email_receipt == 1) { // Get Email Template - $config_et_client_invoice_paymentfull = htmlspecialchars_decode($config_et_client_invoice_paymentfull); - $config_et_client_invoice_paymentfull = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_invoice_paymentfull); + $config_et_client_invoice_paymentfull = prepareEmailTemplate($config_et_client_invoice_paymentfull); $subject = "$company_name Payment Received - Invoice $invoice_prefix$invoice_number"; $body = "$config_et_client_invoice_paymentfull"; @@ -715,13 +710,8 @@ if ($email_receipt == 1) { - // Get Email Template - $config_et_client_invoice_paymentpartial = htmlspecialchars_decode($config_et_client_invoice_paymentpartial); - $config_et_client_invoice_paymentpartial = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_invoice_paymentpartial); + // Get Email Template + $config_et_client_invoice_paymentpartial = prepareEmailTemplate($config_et_client_invoice_paymentpartial); $subject = "$company_name Partial Payment Received - Invoice $invoice_prefix$invoice_number"; $body = "$config_et_client_invoice_paymentpartial"; @@ -883,12 +873,7 @@ $config_invoice_from_email = sanitizeInput($config_invoice_from_email); // Get Email Template - $config_et_client_invoice_paymentmultiple = htmlspecialchars_decode($config_et_client_invoice_paymentmultiple); - $config_et_client_invoice_paymentmultiple = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_invoice_paymentmultiple); + $config_et_client_invoice_paymentmultiple = prepareEmailTemplate($config_et_client_invoice_paymentmultiple); $subject = "Payment Received - Multiple Invoices"; $body = "$config_et_client_invoice_paymentmultiple"; @@ -1016,24 +1001,14 @@ if ($invoice_status == 'Paid') { // Get Email Template - $config_et_client_invoice_paid = htmlspecialchars_decode($config_et_client_invoice_paid); - $config_et_client_invoice_paid = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_invoice_paid); + $config_et_client_invoice_paid = prepareEmailTemplate($config_et_client_invoice_paid); $subject = "$company_name Invoice $invoice_prefix$invoice_number Receipt"; $body = "$config_et_client_invoice_paid"; } else { // Get Email Template - $config_et_client_invoice_new = htmlspecialchars_decode($config_et_client_invoice_new); - $config_et_client_invoice_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_invoice_new); + $config_et_client_invoice_new = prepareEmailTemplate($config_et_client_invoice_new); $subject = "$company_name Invoice $invoice_prefix$invoice_number"; $body = "$config_et_client_invoice_new"; @@ -1214,12 +1189,7 @@ $config_invoice_from_name = sanitizeInput($config_invoice_from_name); // Get Email Template - $config_et_client_invoice_newrecurring = htmlspecialchars_decode($config_et_client_invoice_newrecurring); - $config_et_client_invoice_newrecurring = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_invoice_newrecurring); + $config_et_client_invoice_newrecurring = prepareEmailTemplate($config_et_client_invoice_newrecurring); // Email to client diff --git a/post/quote.php b/post/quote.php index 05eb9cc5d..91e424126 100644 --- a/post/quote.php +++ b/post/quote.php @@ -391,12 +391,7 @@ $config_base_url = sanitizeInput($config_base_url); // Get Email Template - $config_et_client_quote_new = htmlspecialchars_decode($config_et_client_quote_new); - $config_et_client_quote_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_quote_new); + $config_et_client_quote_new = prepareEmailTemplate($config_et_client_quote_new); $subject = "Quote [$quote_scope]"; $body = "$config_et_client_quote_new"; diff --git a/post/ticket.php b/post/ticket.php index 0ac9f11ef..48bd249c5 100644 --- a/post/ticket.php +++ b/post/ticket.php @@ -26,7 +26,6 @@ $project_id = intval($_POST['project']); $use_primary_contact = intval($_POST['use_primary_contact']); $ticket_template_id = intval($_POST['ticket_template_id']); - $config_et_client_ticket_update = $row['config_et_client_ticket_update']; // Check to see if adding a ticket by template if($ticket_template_id) { @@ -136,12 +135,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_client_ticket_new = htmlspecialchars_decode($config_et_client_ticket_new); - $config_et_client_ticket_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_ticket_new); + $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new); // Verify contact email is valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { @@ -244,12 +238,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_client_ticket_new = htmlspecialchars_decode($config_et_client_ticket_new); - $config_et_client_ticket_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_ticket_new); + $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new); // Email content $data = []; // Queue array @@ -342,12 +331,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_client_ticket_new = htmlspecialchars_decode($config_et_client_ticket_new); - $config_et_client_ticket_new = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_ticket_new); + $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new); // Email content $data = []; // Queue array @@ -420,12 +404,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_watcher_notify = htmlspecialchars_decode($config_et_watcher_notify); - $config_et_watcher_notify = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_watcher_notify); + $config_et_watcher_notify = prepareEmailTemplate($config_et_watcher_notify); // Email content @@ -896,12 +875,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_client_ticket_closed = htmlspecialchars_decode($config_et_client_ticket_closed); - $config_et_client_ticket_closed = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_ticket_closed); + $config_et_client_ticket_closed = prepareEmailTemplate($config_et_client_ticket_closed); // Check email valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { @@ -1021,12 +995,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_client_ticket_update = htmlspecialchars_decode($config_et_client_ticket_update); - $config_et_client_ticket_update = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_ticket_update); + $config_et_client_ticket_update = prepareEmailTemplate($config_et_client_ticket_update); // Send e-mail to client if public update & email is set up if ($private_note == 0 && !empty($config_smtp_host)) { @@ -1208,22 +1177,6 @@ $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); - // Get Email Template AutoClose - $config_et_client_ticket_autoclose = htmlspecialchars_decode($config_et_client_ticket_autoclose); - $config_et_client_ticket_autoclose = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_ticket_autoclose); - - // Get Email Template Update - $config_et_client_ticket_update = htmlspecialchars_decode($config_et_client_ticket_update); - $config_et_client_ticket_update = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_ticket_update); - // Send e-mail to client if public update & email is set up if ($ticket_reply_type == 'Public' && $send_email == 1 && !empty($config_smtp_host)) { @@ -1233,10 +1186,18 @@ // Slightly different email subject/text depending on if this update set auto-close if ($ticket_status == 4) { + + // Get Email Template AutoClose + $config_et_client_ticket_autoclose = prepareEmailTemplate($config_et_client_ticket_autoclose); + // Auto-close $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject | (pending closure)"; $body = "$config_et_client_ticket_autoclose"; } else { + + // Get Email Template Update + $config_et_client_ticket_update = prepareEmailTemplate($config_et_client_ticket_update); + // Anything else $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject"; $body = "$config_et_client_ticket_update"; @@ -1463,12 +1424,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_client_ticket_closed = htmlspecialchars_decode($config_et_client_ticket_closed); - $config_et_client_ticket_closed = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $config_et_client_ticket_closed); + $config_et_client_ticket_closed = prepareEmailTemplate($config_et_client_ticket_closed); // Check email valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { From dc9ae5d92e849f97cccfd895f81e4a81905c134d Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Thu, 27 Jun 2024 09:15:42 -0400 Subject: [PATCH 04/14] Auto prepend ticket replies with "##- Please type your reply above this line -##" --- cron.php | 2 +- cron_ticket_email_parser.php | 2 +- functions.php | 31 ++++++++++++++++++++++--------- post/ticket.php | 14 +++++++------- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/cron.php b/cron.php index 38ef0718d..1cd918b73 100644 --- a/cron.php +++ b/cron.php @@ -431,7 +431,7 @@ $ticket_reply = $ticket_reply_row['ticket_reply']; // Get Email Template - $config_et_client_ticket_autoclose = prepareEmailTemplate($config_et_client_ticket_autoclose); + $config_et_client_ticket_autoclose = prepareEmailTemplate($config_et_client_ticket_autoclose, true); $subject = "Ticket pending closure - [$ticket_prefix$ticket_number] - $ticket_subject"; diff --git a/cron_ticket_email_parser.php b/cron_ticket_email_parser.php index 69f5d4990..b777e1bde 100644 --- a/cron_ticket_email_parser.php +++ b/cron_ticket_email_parser.php @@ -135,7 +135,7 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date if ($config_ticket_client_general_notifications == 1) { // Get Email Template - $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new); + $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true); $subject_email = "Ticket created - [$config_ticket_prefix$ticket_number] - $subject"; $body = "$config_et_client_ticket_new"; diff --git a/functions.php b/functions.php index 780308b36..9e691e49c 100644 --- a/functions.php +++ b/functions.php @@ -736,18 +736,31 @@ function sanitizeForEmail($data) return $sanitized; } -function prepareEmailTemplate($emailtemplate) +function prepareEmailTemplate($emailtemplate, $ticketreply = false) { - $emailtemplate = htmlspecialchars_decode($emailtemplate, ENT_QUOTES); - $emailtemplate = str_replace("'", "\'", $emailtemplate); - $emailtemplate = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $emailtemplate); - return $emailtemplate; + // Check if $ticketreply is true, then prepend the line + if ($ticketreply) { + $prependText = "##- Please type your reply above this line -##\n

"; + $emailtemplate = $prependText . $emailtemplate; + } + + // Decode HTML entities + $emailtemplate = htmlspecialchars_decode($emailtemplate, ENT_QUOTES); + + // Replace single quotes with escaped quotes + $emailtemplate = str_replace("'", "\'", $emailtemplate); + + // Perform variable substitution + $emailtemplate = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $emailtemplate); + + return $emailtemplate; } + function timeAgo($datetime) { $time = strtotime($datetime); diff --git a/post/ticket.php b/post/ticket.php index 48bd249c5..02f9d7755 100644 --- a/post/ticket.php +++ b/post/ticket.php @@ -135,7 +135,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new); + $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true); // Verify contact email is valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { @@ -238,7 +238,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new); + $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true); // Email content $data = []; // Queue array @@ -331,7 +331,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new); + $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true); // Email content $data = []; // Queue array @@ -404,7 +404,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_watcher_notify = prepareEmailTemplate($config_et_watcher_notify); + $config_et_watcher_notify = prepareEmailTemplate($config_et_watcher_notify, true); // Email content @@ -995,7 +995,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_client_ticket_update = prepareEmailTemplate($config_et_client_ticket_update); + $config_et_client_ticket_update = prepareEmailTemplate($config_et_client_ticket_update, true); // Send e-mail to client if public update & email is set up if ($private_note == 0 && !empty($config_smtp_host)) { @@ -1188,7 +1188,7 @@ if ($ticket_status == 4) { // Get Email Template AutoClose - $config_et_client_ticket_autoclose = prepareEmailTemplate($config_et_client_ticket_autoclose); + $config_et_client_ticket_autoclose = prepareEmailTemplate($config_et_client_ticket_autoclose, true); // Auto-close $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject | (pending closure)"; @@ -1196,7 +1196,7 @@ } else { // Get Email Template Update - $config_et_client_ticket_update = prepareEmailTemplate($config_et_client_ticket_update); + $config_et_client_ticket_update = prepareEmailTemplate($config_et_client_ticket_update, true); // Anything else $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject"; From 4be93548deb6cc8944d18aa291ff7dbe3b598430 Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Thu, 27 Jun 2024 09:20:55 -0400 Subject: [PATCH 05/14] Fixed template assignment For tickets updated but pending closure --- post/ticket.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/post/ticket.php b/post/ticket.php index 02f9d7755..68df4180c 100644 --- a/post/ticket.php +++ b/post/ticket.php @@ -1188,11 +1188,11 @@ if ($ticket_status == 4) { // Get Email Template AutoClose - $config_et_client_ticket_autoclose = prepareEmailTemplate($config_et_client_ticket_autoclose, true); + $config_et_client_ticket_updatedpendingclosure = prepareEmailTemplate($config_et_client_ticket_updatedpendingclosure, true); // Auto-close $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject | (pending closure)"; - $body = "$config_et_client_ticket_autoclose"; + $body = "$config_et_client_ticket_updatedpendingclosure"; } else { // Get Email Template Update From bf3433dace3b0ea51621b2c52074ce2f53fb9ea8 Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Sat, 29 Jun 2024 11:30:33 -0400 Subject: [PATCH 06/14] Added subject line editor, shortened overly long code --- ajax.php | 5 +- cron.php | 9 ++- cron_ticket_email_parser.php | 3 +- functions.php | 32 ++++++---- get_settings.php | 50 +++++++++------- guest_pay_invoice_stripe.php | 3 +- portal/login_reset.php | 6 +- post/contact.php | 3 +- post/event.php | 6 +- post/invoice.php | 18 ++++-- post/quote.php | 3 +- post/setting.php | 111 +++++++++++++++++++---------------- post/ticket.php | 27 ++++++--- settings_mail.php | 80 ++++++++++++++++--------- 14 files changed, 220 insertions(+), 136 deletions(-) diff --git a/ajax.php b/ajax.php index e8a38e4b7..8f62c9a4a 100644 --- a/ajax.php +++ b/ajax.php @@ -303,13 +303,14 @@ // Get Email Template $config_et_client_securelink = prepareEmailTemplate($config_et_client_securelink); + $config_et_client_securelink_subj = prepareEmailTemplateTags($config_et_client_securelink_subj); // Send user e-mail, if specified if(!empty($config_smtp_host) && filter_var($item_email, FILTER_VALIDATE_EMAIL)){ - $subject = "Time sensitive - $company_name secure link enclosed"; + $subject = "$config_et_client_securelink_subj"; if ($item_expires_friendly == "never") { - $subject = "$company_name secure link enclosed"; + $subject = "$config_et_client_securelink_subj"; } $body = "$config_et_client_securelink"; diff --git a/cron.php b/cron.php index 1cd918b73..d06496a1f 100644 --- a/cron.php +++ b/cron.php @@ -432,8 +432,9 @@ // Get Email Template $config_et_client_ticket_autoclose = prepareEmailTemplate($config_et_client_ticket_autoclose, true); + $config_et_client_ticket_autoclose_subj = prepareEmailTemplateTags($config_et_client_ticket_autoclose_subj); - $subject = "Ticket pending closure - [$ticket_prefix$ticket_number] - $ticket_subject"; + $subject = "$config_et_client_ticket_autoclose_subj"; $body = "$config_et_client_ticket_autoclose"; @@ -496,6 +497,7 @@ // Get Email Template $config_et_client_invoice_paymentreminder = prepareEmailTemplate($config_et_client_invoice_paymentreminder); + $config_et_client_invoice_paymentreminder_subj = prepareEmailTemplateTags($config_et_client_invoice_paymentreminder_subj); // Late Charges @@ -518,7 +520,7 @@ 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 = "$company_name Overdue Invoice $invoice_prefix$invoice_number"; + $subject = "$config_et_client_invoice_paymentreminder_subj"; $body = "$config_et_client_invoice_paymentreminder"; $mail = addToMailQueue($mysqli, [ @@ -639,8 +641,9 @@ // Get Email Template $config_et_client_invoice_newrecurring = prepareEmailTemplate($config_et_client_invoice_newrecurring); + $config_et_client_invoice_newrecurring_subj = prepareEmailTemplateTags($config_et_client_invoice_newrecurring_subj); - $subject = "$company_name Invoice $invoice_prefix$invoice_number"; + $subject = "$config_et_client_invoice_newrecurring_subj"; $body = "$config_et_client_invoice_newrecurring"; $mail = addToMailQueue($mysqli, [ diff --git a/cron_ticket_email_parser.php b/cron_ticket_email_parser.php index b777e1bde..967660618 100644 --- a/cron_ticket_email_parser.php +++ b/cron_ticket_email_parser.php @@ -136,8 +136,9 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date // Get Email Template $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true); + $config_et_client_ticket_new_subj = prepareEmailTemplateTags($config_et_client_ticket_new_subj); - $subject_email = "Ticket created - [$config_ticket_prefix$ticket_number] - $subject"; + $subject_email = "$config_et_client_ticket_new_subj"; $body = "$config_et_client_ticket_new"; $data[] = [ diff --git a/functions.php b/functions.php index 9e691e49c..fc5ab67cf 100644 --- a/functions.php +++ b/functions.php @@ -730,12 +730,29 @@ function sanitizeInput($input) function sanitizeForEmail($data) { - $sanitized = htmlspecialchars($data, ENT_QUOTES); + $sanitized = htmlspecialchars($data); $sanitized = strip_tags($sanitized); $sanitized = trim($sanitized); return $sanitized; } +// Email Template [tag] Replacement +function prepareEmailTemplateTags($emailTemplateTags) +{ + // Perform variable substitution - find [tags] + $emailTemplateTags = preg_replace_callback('/\[(.*?)\]/', function($matches) { + $var_name = $matches[1]; + global $$var_name; + return $$var_name; + }, $emailTemplateTags); + + // Replace single quotes with escaped quotes + $emailTemplateTags = str_replace("'", "\'", $emailTemplateTags); + + return $emailTemplateTags; +} + +// Prepare Email Template function prepareEmailTemplate($emailtemplate, $ticketreply = false) { // Check if $ticketreply is true, then prepend the line @@ -745,17 +762,10 @@ function prepareEmailTemplate($emailtemplate, $ticketreply = false) } // Decode HTML entities - $emailtemplate = htmlspecialchars_decode($emailtemplate, ENT_QUOTES); - - // Replace single quotes with escaped quotes - $emailtemplate = str_replace("'", "\'", $emailtemplate); + $emailtemplate = htmlspecialchars_decode($emailtemplate); - // Perform variable substitution - $emailtemplate = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; - }, $emailtemplate); + // Email Template [tag] replacement + $emailtemplate = prepareEmailTemplateTags($emailtemplate); return $emailtemplate; } diff --git a/get_settings.php b/get_settings.php index 452cfc59b..3b27d3a2d 100644 --- a/get_settings.php +++ b/get_settings.php @@ -25,28 +25,36 @@ $config_imap_encryption = $row['config_imap_encryption']; $config_imap_username = $row['config_imap_username']; $config_imap_password = $row['config_imap_password']; + // Mail - Email Templates -$config_et_client_ticket_new = $row['config_et_client_ticket_new']; -$config_et_client_ticket_update = $row['config_et_client_ticket_update']; -$config_et_client_ticket_autoclose = $row['config_et_client_ticket_autoclose']; -$config_et_client_ticket_updatedpendingclosure = $row['config_et_client_ticket_updatedpendingclosure']; -$config_et_client_ticket_closed = $row['config_et_client_ticket_closed']; -$config_et_client_app_newaccount = $row['config_et_client_app_newaccount']; -$config_et_client_app_passwordreset = $row['config_et_client_app_passwordreset']; -$config_et_client_app_passwordresetcomplete = $row['config_et_client_app_passwordresetcomplete']; -$config_et_client_calendar_rescheduled = $row['config_et_client_calendar_rescheduled']; -$config_et_client_calendar_scheduled = $row['config_et_client_calendar_scheduled']; -$config_et_client_invoice_new = $row['config_et_client_invoice_new']; -$config_et_client_invoice_newrecurring = $row['config_et_client_invoice_newrecurring']; -$config_et_client_invoice_paid = $row['config_et_client_invoice_paid']; -$config_et_client_invoice_paymentfull = $row['config_et_client_invoice_paymentfull']; -$config_et_client_invoice_paymentmultiple = $row['config_et_client_invoice_paymentmultiple']; -$config_et_client_invoice_paymentpartial = $row['config_et_client_invoice_paymentpartial']; -$config_et_client_invoice_paymentreminder = $row['config_et_client_invoice_paymentreminder']; -$config_et_client_invoice_paymentstripe = $row['config_et_client_invoice_paymentstripe']; -$config_et_client_quote_new = $row['config_et_client_quote_new']; -$config_et_client_securelink = $row['config_et_client_securelink']; -$config_et_watcher_notify = $row['config_et_watcher_notify']; +$email_template_keys = [ + 'config_et_client_ticket_new', 'config_et_client_ticket_update', 'config_et_client_ticket_autoclose', + 'config_et_client_ticket_updatedpendingclosure', 'config_et_client_ticket_closed', 'config_et_client_app_newaccount', + 'config_et_client_app_passwordreset', 'config_et_client_app_passwordresetcomplete', 'config_et_client_calendar_rescheduled', + 'config_et_client_calendar_scheduled', 'config_et_client_invoice_new', 'config_et_client_invoice_newrecurring', + 'config_et_client_invoice_paid', 'config_et_client_invoice_paymentfull', 'config_et_client_invoice_paymentmultiple', + 'config_et_client_invoice_paymentpartial', 'config_et_client_invoice_paymentreminder', 'config_et_client_invoice_paymentstripe', + 'config_et_client_quote_new', 'config_et_client_securelink', 'config_et_watcher_notify' +]; + +foreach ($email_template_keys as $key) { + ${$key} = $row[$key]; +} + +// Mail - Email Template Subjects +$email_subject_keys = [ + 'config_et_client_ticket_new_subj', 'config_et_client_ticket_update_subj', 'config_et_client_ticket_autoclose_subj', + 'config_et_client_ticket_updatedpendingclosure_subj', 'config_et_client_ticket_closed_subj', 'config_et_client_app_newaccount_subj', + 'config_et_client_app_passwordreset_subj', 'config_et_client_app_passwordresetcomplete_subj', 'config_et_client_calendar_rescheduled_subj', + 'config_et_client_calendar_scheduled_subj', 'config_et_client_invoice_new_subj', 'config_et_client_invoice_newrecurring_subj', + 'config_et_client_invoice_paid_subj', 'config_et_client_invoice_paymentfull_subj', 'config_et_client_invoice_paymentmultiple_subj', + 'config_et_client_invoice_paymentpartial_subj', 'config_et_client_invoice_paymentreminder_subj', 'config_et_client_invoice_paymentstripe_subj', + 'config_et_client_quote_new_subj', 'config_et_client_securelink_subj', 'config_et_watcher_notify_subj' +]; + +foreach ($email_subject_keys as $key) { + ${$key} = $row[$key]; +} // Defaults diff --git a/guest_pay_invoice_stripe.php b/guest_pay_invoice_stripe.php index 44b878c5a..f1a9a6e80 100644 --- a/guest_pay_invoice_stripe.php +++ b/guest_pay_invoice_stripe.php @@ -355,9 +355,10 @@ function log_to_console($message) { // Get Email Template $config_et_client_invoice_paymentstripe = prepareEmailTemplate($config_et_client_invoice_paymentstripe); + $config_et_client_invoice_paymentstripe_subj = prepareEmailTemplateTags($config_et_client_invoice_paymentstripe_subj); if (!empty($config_smtp_host)) { - $subject = "Payment Received - Invoice $invoice_prefix$invoice_number"; + $subject = "$config_et_client_invoice_paymentstripe_subj"; $body = "$config_et_client_invoice_paymentstripe"; $data = [ diff --git a/portal/login_reset.php b/portal/login_reset.php index 8b6e28d60..0be050f45 100644 --- a/portal/login_reset.php +++ b/portal/login_reset.php @@ -80,9 +80,10 @@ // Get Email Template $config_et_client_app_passwordreset = prepareEmailTemplate($config_et_client_app_passwordreset); + $config_et_client_app_passwordreset_subj = prepareEmailTemplateTags($config_et_client_app_passwordreset_subj); // Send reset email - $subject = "Password reset for $company_name Client Portal"; + $subject = "$config_et_client_app_passwordreset_subj"; $body = "$config_et_client_app_passwordreset"; $data = [ @@ -136,9 +137,10 @@ // Get Email Template $config_et_client_app_passwordresetcomplete = prepareEmailTemplate($config_et_client_app_passwordresetcomplete); + $config_et_client_app_passwordresetcomplete_subj = prepareEmailTemplateTags($config_et_client_app_passwordresetcomplete_subj); // Send confirmation email - $subject = "Password reset confirmation for $company_name Client Portal"; + $subject = "$config_et_client_app_passwordresetcomplete_subj"; $body = "$config_et_client_app_passwordresetcomplete"; diff --git a/post/contact.php b/post/contact.php index afa75e051..00c1c5809 100644 --- a/post/contact.php +++ b/post/contact.php @@ -152,8 +152,9 @@ // Get Email Template $config_et_client_app_newaccount = prepareEmailTemplate($config_et_client_app_newaccount); + $config_et_client_app_newaccount_subj = prepareEmailTemplateTags($config_et_client_app_newaccount_subj); - $subject = "Your new $company_name portal account"; + $subject = "$config_et_client_app_newaccount_subj"; $body = "$config_et_client_app_newaccount"; // Queue Mail diff --git a/post/event.php b/post/event.php index 288cdd551..021571eee 100644 --- a/post/event.php +++ b/post/event.php @@ -77,12 +77,13 @@ // Get Email Template $config_et_client_calendar_scheduled = prepareEmailTemplate($config_et_client_calendar_scheduled); + $config_et_client_calendar_scheduled_subj = prepareEmailTemplateTags($config_et_client_calendar_scheduled_subj); // Sanitize Config Vars from get_settings.php and Session Vars from check_login.php $config_mail_from_name = sanitizeInput($config_mail_from_name); $config_mail_from_email = sanitizeInput($config_mail_from_email); - $subject = "New Calendar Event"; + $subject = "$config_et_client_calendar_scheduled_subj"; $body = "$config_et_client_calendar_scheduled"; $data = [ @@ -149,13 +150,14 @@ // Get Email Template $config_et_client_calendar_rescheduled = prepareEmailTemplate($config_et_client_calendar_rescheduled); + $config_et_client_calendar_rescheduled_subj = prepareEmailTemplateTags($config_et_client_calendar_rescheduled_subj); // Sanitize Config Vars from get_settings.php and Session Vars from check_login.php $config_mail_from_name = sanitizeInput($config_mail_from_name); $config_mail_from_email = sanitizeInput($config_mail_from_email); - $subject = "Calendar Event Rescheduled"; + $subject = "$config_et_client_calendar_rescheduled_subj"; $body = "$config_et_client_calendar_rescheduled"; $data = [ diff --git a/post/invoice.php b/post/invoice.php index 986ee0643..8199da1c1 100644 --- a/post/invoice.php +++ b/post/invoice.php @@ -677,8 +677,9 @@ // Get Email Template $config_et_client_invoice_paymentfull = prepareEmailTemplate($config_et_client_invoice_paymentfull); + $config_et_client_invoice_paymentfull_subj = prepareEmailTemplateTags($config_et_client_invoice_paymentfull_subj); - $subject = "$company_name Payment Received - Invoice $invoice_prefix$invoice_number"; + $subject = "$config_et_client_invoice_paymentfull_subj"; $body = "$config_et_client_invoice_paymentfull"; // Queue Mail @@ -712,8 +713,9 @@ // Get Email Template $config_et_client_invoice_paymentpartial = prepareEmailTemplate($config_et_client_invoice_paymentpartial); + $config_et_client_invoice_paymentpartial_subj = prepareEmailTemplateTags($config_et_client_invoice_paymentpartial_subj); - $subject = "$company_name Partial Payment Received - Invoice $invoice_prefix$invoice_number"; + $subject = "$config_et_client_invoice_paymentpartial_subj"; $body = "$config_et_client_invoice_paymentpartial"; // Queue Mail @@ -874,8 +876,9 @@ // Get Email Template $config_et_client_invoice_paymentmultiple = prepareEmailTemplate($config_et_client_invoice_paymentmultiple); + $config_et_client_invoice_paymentmultiple_subj = prepareEmailTemplateTags($config_et_client_invoice_paymentmultiple_subj); - $subject = "Payment Received - Multiple Invoices"; + $subject = "$config_et_client_invoice_paymentmultiple_subj"; $body = "$config_et_client_invoice_paymentmultiple"; // Queue Mail @@ -1002,15 +1005,17 @@ // Get Email Template $config_et_client_invoice_paid = prepareEmailTemplate($config_et_client_invoice_paid); + $config_et_client_invoice_paid_subj = prepareEmailTemplateTags($config_et_client_invoice_paid_subj); - $subject = "$company_name Invoice $invoice_prefix$invoice_number Receipt"; + $subject = "$config_et_client_invoice_paid_subj"; $body = "$config_et_client_invoice_paid"; } else { // Get Email Template $config_et_client_invoice_new = prepareEmailTemplate($config_et_client_invoice_new); + $config_et_client_invoice_new_subj = prepareEmailTemplateTags($config_et_client_invoice_new_subj); - $subject = "$company_name Invoice $invoice_prefix$invoice_number"; + $subject = "$config_et_client_invoice_new_subj"; $body = "$config_et_client_invoice_new"; } @@ -1190,10 +1195,11 @@ // Get Email Template $config_et_client_invoice_newrecurring = prepareEmailTemplate($config_et_client_invoice_newrecurring); + $config_et_client_invoice_newrecurring_subj = prepareEmailTemplateTags($config_et_client_invoice_newrecurring_subj); // Email to client - $subject = "$company_name Invoice $invoice_prefix$invoice_number"; + $subject = "$config_et_client_invoice_newrecurring_subj"; $body = "$config_et_client_invoice_newrecurring"; diff --git a/post/quote.php b/post/quote.php index 91e424126..8bc484825 100644 --- a/post/quote.php +++ b/post/quote.php @@ -392,8 +392,9 @@ // Get Email Template $config_et_client_quote_new = prepareEmailTemplate($config_et_client_quote_new); + $config_et_client_quote_new_subj = prepareEmailTemplateTags($config_et_client_quote_new_subj); - $subject = "Quote [$quote_scope]"; + $subject = "$config_et_client_quote_new_subj"; $body = "$config_et_client_quote_new"; // Queue Mail diff --git a/post/setting.php b/post/setting.php index 8e60ea08f..1a54d0474 100644 --- a/post/setting.php +++ b/post/setting.php @@ -234,63 +234,76 @@ // Email templates if (isset($_POST['edit_mail_email_template'])) { - - validateCSRFToken($_POST['csrf_token']); + validateCSRFToken($_POST['csrf_token']); validateAdminRole(); - $config_et_client_ticket_new = sanitizeForEmail($_POST['config_et_client_ticket_new']); - $config_et_client_ticket_update = sanitizeForEmail($_POST['config_et_client_ticket_update']); - $config_et_client_ticket_autoclose = sanitizeForEmail($_POST['config_et_client_ticket_autoclose']); - $config_et_client_ticket_updatedpendingclosure = sanitizeForEmail($_POST['config_et_client_ticket_updatedpendingclosure']); - $config_et_client_ticket_closed = sanitizeForEmail($_POST['config_et_client_ticket_closed']); - $config_et_client_app_newaccount = sanitizeForEmail($_POST['config_et_client_app_newaccount']); - $config_et_client_app_passwordreset = sanitizeForEmail($_POST['config_et_client_app_passwordreset']); - $config_et_client_app_passwordresetcomplete = sanitizeForEmail($_POST['config_et_client_app_passwordresetcomplete']); - $config_et_client_calendar_rescheduled = sanitizeForEmail($_POST['config_et_client_calendar_rescheduled']); - $config_et_client_calendar_scheduled = sanitizeForEmail($_POST['config_et_client_calendar_scheduled']); - $config_et_client_invoice_new = sanitizeForEmail($_POST['config_et_client_invoice_new']); - $config_et_client_invoice_newrecurring = sanitizeForEmail($_POST['config_et_client_invoice_newrecurring']); - $config_et_client_invoice_paid = sanitizeForEmail($_POST['config_et_client_invoice_paid']); - $config_et_client_invoice_paymentfull = sanitizeForEmail($_POST['config_et_client_invoice_paymentfull']); - $config_et_client_invoice_paymentmultiple = sanitizeForEmail($_POST['config_et_client_invoice_paymentmultiple']); - $config_et_client_invoice_paymentpartial = sanitizeForEmail($_POST['config_et_client_invoice_paymentpartial']); - $config_et_client_invoice_paymentreminder = sanitizeForEmail($_POST['config_et_client_invoice_paymentreminder']); - $config_et_client_invoice_paymentstripe = sanitizeForEmail($_POST['config_et_client_invoice_paymentstripe']); - $config_et_client_quote_new = sanitizeForEmail($_POST['config_et_client_quote_new']); - $config_et_client_securelink = sanitizeForEmail($_POST['config_et_client_securelink']); - $config_et_watcher_notify = sanitizeForEmail($_POST['config_et_watcher_notify']); - - mysqli_query($mysqli, "UPDATE settings SET - config_et_client_ticket_new = '$config_et_client_ticket_new', - config_et_client_ticket_update = '$config_et_client_ticket_update', - config_et_client_ticket_autoclose = '$config_et_client_ticket_autoclose', - config_et_client_ticket_updatedpendingclosure = '$config_et_client_ticket_updatedpendingclosure', - config_et_client_ticket_closed = '$config_et_client_ticket_closed', - config_et_client_app_newaccount = '$config_et_client_app_newaccount', - config_et_client_app_passwordreset = '$config_et_client_app_passwordreset', - config_et_client_app_passwordresetcomplete = '$config_et_client_app_passwordresetcomplete', - config_et_client_calendar_rescheduled = '$config_et_client_calendar_rescheduled', - config_et_client_calendar_scheduled = '$config_et_client_calendar_scheduled', - config_et_client_invoice_new = '$config_et_client_invoice_new', - config_et_client_invoice_newrecurring = '$config_et_client_invoice_newrecurring', - config_et_client_invoice_paid = '$config_et_client_invoice_paid', - config_et_client_invoice_paymentfull = '$config_et_client_invoice_paymentfull', - config_et_client_invoice_paymentmultiple = '$config_et_client_invoice_paymentmultiple', - config_et_client_invoice_paymentpartial = '$config_et_client_invoice_paymentpartial', - config_et_client_invoice_paymentreminder = '$config_et_client_invoice_paymentreminder', - config_et_client_invoice_paymentstripe = '$config_et_client_invoice_paymentstripe', - config_et_client_quote_new = '$config_et_client_quote_new', - config_et_client_securelink = '$config_et_client_securelink', - config_et_watcher_notify = '$config_et_watcher_notify' - WHERE company_id = 1"); + $fields = [ + 'config_et_client_ticket_new' => 'sanitizeForEmail', + 'config_et_client_ticket_new_subj' => 'sanitizeInput', + 'config_et_client_ticket_update' => 'sanitizeForEmail', + 'config_et_client_ticket_update_subj' => 'sanitizeInput', + 'config_et_client_ticket_autoclose' => 'sanitizeForEmail', + 'config_et_client_ticket_autoclose_subj' => 'sanitizeInput', + 'config_et_client_ticket_updatedpendingclosure' => 'sanitizeForEmail', + 'config_et_client_ticket_updatedpendingclosure_subj' => 'sanitizeInput', + 'config_et_client_ticket_closed' => 'sanitizeForEmail', + 'config_et_client_ticket_closed_subj' => 'sanitizeInput', + 'config_et_client_app_newaccount' => 'sanitizeForEmail', + 'config_et_client_app_newaccount_subj' => 'sanitizeInput', + 'config_et_client_app_passwordreset' => 'sanitizeForEmail', + 'config_et_client_app_passwordreset_subj' => 'sanitizeInput', + 'config_et_client_app_passwordresetcomplete' => 'sanitizeForEmail', + 'config_et_client_app_passwordresetcomplete_subj' => 'sanitizeInput', + 'config_et_client_calendar_rescheduled' => 'sanitizeForEmail', + 'config_et_client_calendar_rescheduled_subj' => 'sanitizeInput', + 'config_et_client_calendar_scheduled' => 'sanitizeForEmail', + 'config_et_client_calendar_scheduled_subj' => 'sanitizeInput', + 'config_et_client_invoice_new' => 'sanitizeForEmail', + 'config_et_client_invoice_new_subj' => 'sanitizeInput', + 'config_et_client_invoice_newrecurring' => 'sanitizeForEmail', + 'config_et_client_invoice_newrecurring_subj' => 'sanitizeInput', + 'config_et_client_invoice_paid' => 'sanitizeForEmail', + 'config_et_client_invoice_paid_subj' => 'sanitizeInput', + 'config_et_client_invoice_paymentfull' => 'sanitizeForEmail', + 'config_et_client_invoice_paymentfull_subj' => 'sanitizeInput', + 'config_et_client_invoice_paymentmultiple' => 'sanitizeForEmail', + 'config_et_client_invoice_paymentmultiple_subj' => 'sanitizeInput', + 'config_et_client_invoice_paymentpartial' => 'sanitizeForEmail', + 'config_et_client_invoice_paymentpartial_subj' => 'sanitizeInput', + 'config_et_client_invoice_paymentreminder' => 'sanitizeForEmail', + 'config_et_client_invoice_paymentreminder_subj' => 'sanitizeInput', + 'config_et_client_invoice_paymentstripe' => 'sanitizeForEmail', + 'config_et_client_invoice_paymentstripe_subj' => 'sanitizeInput', + 'config_et_client_quote_new' => 'sanitizeForEmail', + 'config_et_client_quote_new_subj' => 'sanitizeInput', + 'config_et_client_securelink' => 'sanitizeForEmail', + 'config_et_client_securelink_subj' => 'sanitizeInput', + 'config_et_watcher_notify' => 'sanitizeForEmail', + 'config_et_watcher_notify_subj' => 'sanitizeInput', + ]; + + foreach ($fields as $field => $sanitizeFunction) { + ${$field} = $sanitizeFunction($_POST[$field]); + } + + $updates = []; + foreach ($fields as $field => $_) { + $updates[] = "$field = '${$field}'"; + } + $updateQuery = "UPDATE settings SET " . implode(', ', $updates) . " WHERE company_id = 1"; + mysqli_query($mysqli, $updateQuery); - $_SESSION['alert_message'] = "Email Template updated"; + //Logging + mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Edit', log_description = '$session_name edited email templates', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); + + + $_SESSION['alert_message'] = "Email templates edited"; header("Location: " . $_SERVER["HTTP_REFERER"]); - } + if (isset($_POST['edit_invoice_settings'])) { validateCSRFToken($_POST['csrf_token']); diff --git a/post/ticket.php b/post/ticket.php index 68df4180c..5f84f2069 100644 --- a/post/ticket.php +++ b/post/ticket.php @@ -136,11 +136,12 @@ // Get Email Template $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true); + $config_et_client_ticket_new_subj = prepareEmailTemplateTags($config_et_client_ticket_new_subj); // Verify contact email is valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { - $subject = "Ticket created [$ticket_prefix$ticket_number] - $ticket_subject"; + $subject = "$config_et_client_ticket_new_subj"; $body = "$config_et_client_ticket_new"; // Email Ticket Contact @@ -239,11 +240,12 @@ // Get Email Template $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true); + $config_et_client_ticket_new_subj = prepareEmailTemplateTags($config_et_client_ticket_new_subj); // Email content $data = []; // Queue array - $subject = "Ticket Created - [$ticket_prefix$ticket_number] - $ticket_subject"; + $subject = "$config_et_client_ticket_new_subj"; $body = "$config_et_client_ticket_new"; // Only add contact to email queue if email is valid @@ -332,11 +334,12 @@ // Get Email Template $config_et_client_ticket_new = prepareEmailTemplate($config_et_client_ticket_new, true); + $config_et_client_ticket_new_subj = prepareEmailTemplateTags($config_et_client_ticket_new_subj); // Email content $data = []; // Queue array - $subject = "Ticket Created - [$ticket_prefix$ticket_number] - $ticket_subject"; + $subject = "config_et_client_ticket_new_subj"; $body = "$config_et_client_ticket_new"; // Only add contact to email queue if email is valid @@ -405,12 +408,13 @@ // Get Email Template $config_et_watcher_notify = prepareEmailTemplate($config_et_watcher_notify, true); + $config_et_watcher_notify_subj = prepareEmailTemplateTags($config_et_watcher_notify_subj); // Email content $data = []; // Queue array - $subject = "Ticket Notification - [$ticket_prefix$ticket_number] - $ticket_subject"; + $subject = "$config_et_watcher_notify_subj"; $body = "$config_et_watcher_notify"; // Only add watcher to email queue if email is valid @@ -876,13 +880,14 @@ // Get Email Template $config_et_client_ticket_closed = prepareEmailTemplate($config_et_client_ticket_closed); + $config_et_client_ticket_closed_subj = prepareEmailTemplateTags($config_et_client_ticket_closed_subj); // Check email valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { $data = []; - $subject = "Ticket closed - [$ticket_prefix$ticket_number] - $ticket_subject | (do not reply)"; + $subject = "$config_et_client_ticket_closed_subj"; $body = "$config_et_client_ticket_closed"; // Email Ticket Contact @@ -996,13 +1001,14 @@ // Get Email Template $config_et_client_ticket_update = prepareEmailTemplate($config_et_client_ticket_update, true); + $config_et_client_ticket_update_subj = prepareEmailTemplateTags($config_et_client_ticket_update_subj); // Send e-mail to client if public update & email is set up if ($private_note == 0 && !empty($config_smtp_host)) { if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { - $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject"; + $subject = "$config_et_client_ticket_update_subj"; $body = "$config_et_client_ticket_update"; $data = []; @@ -1189,17 +1195,19 @@ // Get Email Template AutoClose $config_et_client_ticket_updatedpendingclosure = prepareEmailTemplate($config_et_client_ticket_updatedpendingclosure, true); + $config_et_client_ticket_updatedpendingclosure_subj = prepareEmailTemplateTags($config_et_client_ticket_updatedpendingclosure_subj); // Auto-close - $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject | (pending closure)"; + $subject = "$config_et_client_ticket_updatedpendingclosure_subj"; $body = "$config_et_client_ticket_updatedpendingclosure"; } else { // Get Email Template Update $config_et_client_ticket_update = prepareEmailTemplate($config_et_client_ticket_update, true); + $config_et_client_ticket_update_subj = prepareEmailTemplateTags($config_et_client_ticket_update_subj); // Anything else - $subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject"; + $subject = "$config_et_client_ticket_update_subj"; $body = "$config_et_client_ticket_update"; } @@ -1425,13 +1433,14 @@ // Get Email Template $config_et_client_ticket_closed = prepareEmailTemplate($config_et_client_ticket_closed); + $config_et_client_ticket_closed_subj = prepareEmailTemplateTags($config_et_client_ticket_closed_subj); // Check email valid if (filter_var($contact_email, FILTER_VALIDATE_EMAIL)) { $data = []; - $subject = "Ticket closed - [$ticket_prefix$ticket_number] - $ticket_subject | (do not reply)"; + $subject = "$config_et_client_ticket_closed_subj"; $body = "$config_et_client_ticket_closed"; // Email Ticket Contact diff --git a/settings_mail.php b/settings_mail.php index ca248fad5..1db3d39da 100644 --- a/settings_mail.php +++ b/settings_mail.php @@ -369,28 +369,43 @@
- - - - - - - - - - - - - - - - - - - - - - + + + 'Client - Ticket - New', + 'config_et_client_ticket_update' => 'Client - Ticket - Update', + 'config_et_client_ticket_autoclose' => 'Client - Ticket - Auto-Close', + 'config_et_client_ticket_updatedpendingclosure' => 'Client - Ticket - Updated Pending Closure', + 'config_et_client_ticket_closed' => 'Client - Ticket - Closed', + 'config_et_client_app_newaccount' => 'Client - App - New Account', + 'config_et_client_app_passwordreset' => 'Client - App - Password Reset', + 'config_et_client_app_passwordresetcomplete' => 'Client - App - Password Reset Complete', + 'config_et_client_calendar_rescheduled' => 'Client - Calendar - Rescheduled', + 'config_et_client_calendar_scheduled' => 'Client - Calendar - Scheduled', + 'config_et_client_invoice_new' => 'Client - Invoice - New', + 'config_et_client_invoice_newrecurring' => 'Client - Invoice - New Recurring', + 'config_et_client_invoice_paid' => 'Client - Invoice - Paid', + 'config_et_client_invoice_paymentfull' => 'Client - Invoice - Payment Full', + 'config_et_client_invoice_paymentmultiple' => 'Client - Invoice - Payment Multiple', + 'config_et_client_invoice_paymentpartial' => 'Client - Invoice - Payment Partial', + 'config_et_client_invoice_paymentreminder' => 'Client - Invoice - Payment Reminder', + 'config_et_client_invoice_paymentstripe' => 'Client - Invoice - Payment Stripe', + 'config_et_client_quote_new' => 'Client - Quote - New', + 'config_et_client_securelink' => 'Client - Secure Link', + 'config_et_watcher_notify' => 'Watcher - Notify' + ); + + foreach ($templates as $key => $label) { + $subj = ${$key . '_subj'}; // Assuming you have variables like $config_et_client_ticket_new_subj, etc. + $body = ${$key}; // Assuming you have variables like $config_et_client_ticket_new, etc. + ?> + + + + + +

@@ -400,8 +415,9 @@ + From 4e02bcdaf35e6249d2303489b91e5094c9f95981 Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Sun, 30 Jun 2024 12:31:13 -0400 Subject: [PATCH 07/14] Added [shortcode] filtering, [shortcode] menu to the email template editor --- functions.php | 102 +++++++++++++++++++++++++++++++++++++---- post/ticket.php | 2 +- settings_mail.php | 113 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 205 insertions(+), 12 deletions(-) diff --git a/functions.php b/functions.php index fc5ab67cf..ae557d978 100644 --- a/functions.php +++ b/functions.php @@ -736,22 +736,106 @@ function sanitizeForEmail($data) return $sanitized; } -// Email Template [tag] Replacement +// Email Template [tag] [[tag]] and [[tag][tag2]] Replacements function prepareEmailTemplateTags($emailTemplateTags) { - // Perform variable substitution - find [tags] - $emailTemplateTags = preg_replace_callback('/\[(.*?)\]/', function($matches) { - $var_name = $matches[1]; - global $$var_name; - return $$var_name; + // Placeholder to avoid collision with actual content + $placeholderPrefix = '__DOUBLE_BRACKET__'; + $placeholders = []; + $counter = 0; + + // Define the predetermined list of accepted tags + $acceptedTags = [ + 'company_name', + 'config_base_url', + 'ticket_client_id', + 'contact_email', + 'contact_name', + 'ticket_assigned_to', + 'ticket_category', + 'ticket_created_by', + 'ticket_details', + 'ticket_number', + 'ticket_prefix', + 'ticket_priority', + 'ticket_subject', + 'ticket_id', + 'client_id', + 'client_name', + 'invoice_amount', + 'invoice_date', + 'invoice_number', + 'invoice_prefix', + 'invoice_url_key', + 'quote_amount', + 'quote_date', + 'quote_expire', + 'quote_number', + 'quote_prefix', + 'quote_scope', + 'quote_url_key', + 'client_id', + 'contact_email', + 'contact_name', + 'item_email', + 'item_expires_friendly', + 'item_type', + 'item_view_limit', + 'url', + 'name', + 'password_info', + 'username', + 'start', + 'title', + 'ticket_reply', + 'company_phone' + ]; + + // Perform variable substitution for double-bracketed tags [[this]] or [[this][that]] + $emailTemplateTags = preg_replace_callback('/\[\[(.*?)\]\]/', function($matches) use (&$placeholders, &$counter, $placeholderPrefix, $acceptedTags) { + $innerContent = $matches[1]; + $parts = explode('][', $innerContent); + + $result = array_map(function($part) use ($acceptedTags) { + $part = trim($part); + if (in_array($part, $acceptedTags)) { + global $$part; + return isset($$part) ? $$part : '$' . $part; + } + return $part; // Keep the part unchanged if it's not in the accepted list + }, $parts); + + $placeholder = $placeholderPrefix . $counter++; + $placeholders[$placeholder] = '[' . implode('', $result) . ']'; + return $placeholder; + }, $emailTemplateTags); + + // Perform variable substitution for single-bracketed tags [this] + $emailTemplateTags = preg_replace_callback('/\[(.*?)\]/', function($matches) use ($acceptedTags) { + // Ensure the match is not double-bracketed + if (strpos($matches[0], '[[') === false && strpos($matches[0], ']]') === false) { + $var_name = $matches[1]; + if (in_array($var_name, $acceptedTags)) { + global $$var_name; + return isset($$var_name) ? $$var_name : $matches[0]; + } + } + return $matches[0]; // Return the match unchanged if it is double-bracketed or not in the accepted list }, $emailTemplateTags); - - // Replace single quotes with escaped quotes + + // Replace placeholders with actual double-bracketed replacements + foreach ($placeholders as $placeholder => $replacement) { + $emailTemplateTags = str_replace($placeholder, $replacement, $emailTemplateTags); + } + + // Replace single quotes with escaped quotes $emailTemplateTags = str_replace("'", "\'", $emailTemplateTags); - + return $emailTemplateTags; } + + // Prepare Email Template function prepareEmailTemplate($emailtemplate, $ticketreply = false) { diff --git a/post/ticket.php b/post/ticket.php index 5f84f2069..774a629e6 100644 --- a/post/ticket.php +++ b/post/ticket.php @@ -407,7 +407,7 @@ $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Get Email Template - $config_et_watcher_notify = prepareEmailTemplate($config_et_watcher_notify, true); + $config_et_watcher_notify = prepareEmailTemplate($config_et_watcher_notify); $config_et_watcher_notify_subj = prepareEmailTemplateTags($config_et_watcher_notify_subj); diff --git a/settings_mail.php b/settings_mail.php index 1db3d39da..2d30e189b 100644 --- a/settings_mail.php +++ b/settings_mail.php @@ -401,7 +401,7 @@ $body = ${$key}; // Assuming you have variables like $config_et_client_ticket_new, etc. ?> - + @@ -424,7 +424,12 @@ textarea.style.display = 'none'; tinymce.init({ selector: '#' + textarea.id, - menubar: false, + promotion: false, + branding: false, + menubar: 'custom', + menu: { + custom: { title: 'Shortcodes', items: 'info divider companyname companyphone baseurl appsub calendarsub invoicesub ticketsub quotesub securelinksub watchersub' } + }, plugins: 'lists link code table fullscreen', toolbar: 'blocks fontfamily fontsize | bold italic forecolor | link unlink | bullist numlist | alignleft aligncenter alignright alignjustify | outdent indent | table | code fullscreen', setup: function (editor) { @@ -432,6 +437,110 @@ editor.on('init', function () { editor.hide(); }); + editor.ui.registry.addMenuItem('companyname', {text: 'Company Name', onAction: () => editor.insertContent(`[company_name]`)}); + editor.ui.registry.addMenuItem('companyphone', {text: 'Company Phone', onAction: () => editor.insertContent(`[company_phone]`)}); + editor.ui.registry.addMenuItem('baseurl', {text: 'Base URL', onAction: () => editor.insertContent(`[config_base_url]`)}); + editor.ui.registry.addMenuItem('divider', {text: '-----------------------'}); + editor.ui.registry.addMenuItem('info', {text: 'Shortcode Help', onAction: () => editor.notificationManager.open({ + text: 'Please test your email templates before deployment.

Not all shortcodes are available even for their given email template type.
Other shortcodes than what are listed may be available.

Shortcodes may also be used in the Subject line.', + type: 'info' + })}); + editor.ui.registry.addNestedMenuItem('ticketsub', { + text: 'Ticket', + getSubmenuItems: () => [ + {type: 'menuitem', text: 'Client ID', onAction: () => editor.insertContent(`[ticket_client_id]`)}, + {type: 'menuitem', text: 'Contact Email', onAction: () => editor.insertContent(`[contact_email]`)}, + {type: 'menuitem', text: 'Contact Name', onAction: () => editor.insertContent(`[contact_name]`)}, + {type: 'menuitem', text: 'Ticket Assigned To', onAction: () => editor.insertContent(`[ticket_assigned_to]`)}, + {type: 'menuitem', text: 'Ticket Category', onAction: () => editor.insertContent(`[ticket_category]`)}, + {type: 'menuitem', text: 'Ticket Created By', onAction: () => editor.insertContent(`[ticket_created_by]`)}, + {type: 'menuitem', text: 'Ticket Details', onAction: () => editor.insertContent(`[ticket_details]`)}, + {type: 'menuitem', text: 'Ticket Number', onAction: () => editor.insertContent(`[ticket_number]`)}, + {type: 'menuitem', text: 'Ticket Prefix', onAction: () => editor.insertContent(`[ticket_prefix]`)}, + {type: 'menuitem', text: 'Ticket Priority', onAction: () => editor.insertContent(`[ticket_priority]`)}, + {type: 'menuitem', text: 'Ticket Reply Text', onAction: () => editor.insertContent(`[ticket_reply]`)}, + {type: 'menuitem', text: 'Ticket Subject', onAction: () => editor.insertContent(`[ticket_subject]`)}, + {type: 'menuitem', text: 'Ticket URL', onAction: () => editor.insertContent(`https://[config_base_url]/portal/ticket.php?id=[ticket_id]`)}, + ]} + ); + editor.ui.registry.addNestedMenuItem('invoicesub', { + text: 'Invoice', + getSubmenuItems: () => [ + {type: 'menuitem', text: 'Client ID', onAction: () => editor.insertContent(`[client_id]`)}, + {type: 'menuitem', text: 'Client Name', onAction: () => editor.insertContent(`[client_name]`)}, + {type: 'menuitem', text: 'Contact Email', onAction: () => editor.insertContent(`[contact_email]`)}, + {type: 'menuitem', text: 'Contact Name', onAction: () => editor.insertContent(`[contact_name]`)}, + {type: 'menuitem', text: 'Invoice Amount', onAction: () => editor.insertContent(`[invoice_amount]`)}, + {type: 'menuitem', text: 'Invoice Date', onAction: () => editor.insertContent(`[invoice_date]`)}, + {type: 'menuitem', text: 'Invoice Number', onAction: () => editor.insertContent(`[invoice_number]`)}, + {type: 'menuitem', text: 'Invoice Prefix', onAction: () => editor.insertContent(`[invoice_prefix]`)}, + {type: 'menuitem', text: 'Invoice URL Key', onAction: () => editor.insertContent(`[invoice_url_key]`)}, + {type: 'menuitem', text: 'Invoice URL', onAction: () => editor.insertContent(`https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&url_key=[invoice_url_key]`)}, + ]} + ); + editor.ui.registry.addNestedMenuItem('quotesub', { + text: 'Quote', + getSubmenuItems: () => [ + {type: 'menuitem', text: 'Client ID', onAction: () => editor.insertContent(`[client_id]`)}, + {type: 'menuitem', text: 'Client Name', onAction: () => editor.insertContent(`[client_name]`)}, + {type: 'menuitem', text: 'Contact Email', onAction: () => editor.insertContent(`[contact_email]`)}, + {type: 'menuitem', text: 'Contact Name', onAction: () => editor.insertContent(`[contact_name]`)}, + {type: 'menuitem', text: 'Quote Amount', onAction: () => editor.insertContent(`[quote_amount]`)}, + {type: 'menuitem', text: 'Quote Date', onAction: () => editor.insertContent(`[quote_date]`)}, + {type: 'menuitem', text: 'Quote Expire', onAction: () => editor.insertContent(`[quote_expire]`)}, + {type: 'menuitem', text: 'Quote Number', onAction: () => editor.insertContent(`[quote_number]`)}, + {type: 'menuitem', text: 'Quote Prefix', onAction: () => editor.insertContent(`[quote_prefix]`)}, + {type: 'menuitem', text: 'Quote Scope', onAction: () => editor.insertContent(`[quote_scope]`)}, + {type: 'menuitem', text: 'Quote URL Key', onAction: () => editor.insertContent(`[quote_url_key]`)}, + {type: 'menuitem', text: 'Quote URL', onAction: () => editor.insertContent(`https://[config_base_url]/guest_view_quote.php?quote_id=[quote_id]&url_key=[quote_url_key]`)}, + ]} + ); + editor.ui.registry.addNestedMenuItem('securelinksub', { + text: 'Secure Link', + getSubmenuItems: () => [ + {type: 'menuitem', text: 'Client ID', onAction: () => editor.insertContent(`[client_id]`)}, + {type: 'menuitem', text: 'Contact Email', onAction: () => editor.insertContent(`[item_email]`)}, + {type: 'menuitem', text: 'Item Expires In', onAction: () => editor.insertContent(`[item_expires_friendly]`)}, + {type: 'menuitem', text: 'Item Type', onAction: () => editor.insertContent(`[item_type]`)}, + {type: 'menuitem', text: 'Item View Limit', onAction: () => editor.insertContent(`[item_view_limit]`)}, + {type: 'menuitem', text: 'Secure Link URL', onAction: () => editor.insertContent(`[url]`)}, + ]} + ); + editor.ui.registry.addNestedMenuItem('appsub', { + text: 'App', + getSubmenuItems: () => [ + {type: 'menuitem', text: 'Contact Name', onAction: () => editor.insertContent(`[name]`)}, + {type: 'menuitem', text: 'Password Reset URL', onAction: () => editor.insertContent(`[url]`)}, + {type: 'menuitem', text: 'Temporary Password', onAction: () => editor.insertContent(`[password_info]`)}, + {type: 'menuitem', text: 'Username', onAction: () => editor.insertContent(`[username]`)}, + {type: 'menuitem', text: 'Portal URL', onAction: () => editor.insertContent(`https://[config_base_url]/portal/`)}, + ]} + ); + editor.ui.registry.addNestedMenuItem('calendarsub', { + text: 'Calendar', + getSubmenuItems: () => [ + {type: 'menuitem', text: 'Client Name', onAction: () => editor.insertContent(`[client_name]`)}, + {type: 'menuitem', text: 'Contact Name', onAction: () => editor.insertContent(`[contact_name]`)}, + {type: 'menuitem', text: 'Contact Email', onAction: () => editor.insertContent(`[contact_email]`)}, + {type: 'menuitem', text: 'Appointment Date', onAction: () => editor.insertContent(`[start]`)}, + {type: 'menuitem', text: 'Appointment Title', onAction: () => editor.insertContent(`[title]`)}, + ]} + ); + editor.ui.registry.addNestedMenuItem('watchersub', { + text: 'Watcher', + getSubmenuItems: () => [ + {type: 'menuitem', text: 'Client ID', onAction: () => editor.insertContent(`[ticket_client_id]`)}, + {type: 'menuitem', text: 'Ticket Assigned To', onAction: () => editor.insertContent(`[ticket_assigned_to]`)}, + {type: 'menuitem', text: 'Ticket Category', onAction: () => editor.insertContent(`[ticket_category]`)}, + {type: 'menuitem', text: 'Ticket Created By', onAction: () => editor.insertContent(`[ticket_created_by]`)}, + {type: 'menuitem', text: 'Ticket Details', onAction: () => editor.insertContent(`[ticket_details]`)}, + {type: 'menuitem', text: 'Ticket Number', onAction: () => editor.insertContent(`[ticket_number]`)}, + {type: 'menuitem', text: 'Ticket Prefix', onAction: () => editor.insertContent(`[ticket_prefix]`)}, + {type: 'menuitem', text: 'Ticket Priority', onAction: () => editor.insertContent(`[ticket_priority]`)}, + {type: 'menuitem', text: 'Ticket Subject', onAction: () => editor.insertContent(`[ticket_subject]`)}, + {type: 'menuitem', text: 'Ticket URL', onAction: () => editor.insertContent(`https://[config_base_url]/portal/ticket.php?id=[ticket_id]`)}, + ]} + ); } }); }); From 0a4515ebaf7e70dc6c52360675f74cfcf7f9af93 Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Sun, 30 Jun 2024 12:50:39 -0400 Subject: [PATCH 08/14] Added 'email-templates-sample.sql' --- database_updates.php | 32 ++----- db-email-templates.sql | 151 -------------------------------- email-templates-sample.sql | 172 +++++++++++++++++++++++++++++++++++++ 3 files changed, 178 insertions(+), 177 deletions(-) delete mode 100644 db-email-templates.sql create mode 100644 email-templates-sample.sql diff --git a/database_updates.php b/database_updates.php index 593029d24..2ff9ab825 100644 --- a/database_updates.php +++ b/database_updates.php @@ -2077,32 +2077,12 @@ mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.1'"); } - if (CURRENT_DATABASE_VERSION == '1.4.1') { - mysqli_query($mysqli, "ALTER TABLE `settings` - ADD `config_et_client_ticket_new` TEXT, - ADD `config_et_client_ticket_update` TEXT, - ADD `config_et_client_ticket_autoclose` TEXT, - ADD `config_et_client_ticket_updatedpendingclosure` TEXT, - ADD `config_et_client_ticket_closed` TEXT, - ADD `config_et_client_app_newaccount` TEXT, - ADD `config_et_client_app_passwordreset` TEXT, - ADD `config_et_client_app_passwordresetcomplete` TEXT, - ADD `config_et_client_calendar_rescheduled` TEXT, - ADD `config_et_client_calendar_scheduled` TEXT, - ADD `config_et_client_invoice_new` TEXT, - ADD `config_et_client_invoice_newrecurring` TEXT, - ADD `config_et_client_invoice_paid` TEXT, - ADD `config_et_client_invoice_paymentfull` TEXT, - ADD `config_et_client_invoice_paymentmultiple` TEXT, - ADD `config_et_client_invoice_paymentpartial` TEXT, - ADD `config_et_client_invoice_paymentreminder` TEXT, - ADD `config_et_client_invoice_paymentstripe` TEXT, - ADD `config_et_client_quote_new` TEXT, - ADD `config_et_client_securelink` TEXT, - ADD `config_et_watcher_notify` TEXT"); - mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.2'"); - } + // if (CURRENT_DATABASE_VERSION == '1.4.1') { + // // Insert queries here required to update to DB version 1.4.2 + // // Then, update the database to the next sequential version + // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.2'"); + // } } else { // Up-to-date -} +} \ No newline at end of file diff --git a/db-email-templates.sql b/db-email-templates.sql deleted file mode 100644 index 7023cd402..000000000 --- a/db-email-templates.sql +++ /dev/null @@ -1,151 +0,0 @@ --- phpMyAdmin SQL Dump --- version 5.2.1 --- https://www.phpmyadmin.net/ --- --- Host: 127.0.0.1:3306 --- Generation Time: Jun 26, 2024 at 02:24 PM --- Server version: 8.3.0 --- PHP Version: 8.2.18 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -START TRANSACTION; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; - --- --- Database: `itflow` --- - --- -------------------------------------------------------- - --- --- Table structure for table `settings` --- - -DROP TABLE IF EXISTS `settings`; -CREATE TABLE IF NOT EXISTS `settings` ( - `company_id` int NOT NULL, - `config_current_database_version` varchar(10) COLLATE utf8mb4_general_ci NOT NULL, - `config_start_page` varchar(200) COLLATE utf8mb4_general_ci DEFAULT 'clients.php', - `config_smtp_host` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_smtp_port` int DEFAULT NULL, - `config_smtp_encryption` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_smtp_username` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_smtp_password` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_mail_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_mail_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_imap_host` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_imap_port` int DEFAULT NULL, - `config_imap_encryption` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_imap_username` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_imap_password` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_et_client_ticket_new` text COLLATE utf8mb4_general_ci, - `config_et_client_ticket_update` text COLLATE utf8mb4_general_ci, - `config_et_client_ticket_autoclose` text COLLATE utf8mb4_general_ci, - `config_et_client_ticket_updatedpendingclosure` text COLLATE utf8mb4_general_ci, - `config_et_client_ticket_closed` text COLLATE utf8mb4_general_ci, - `config_default_transfer_from_account` int DEFAULT NULL, - `config_default_transfer_to_account` int DEFAULT NULL, - `config_default_payment_account` int DEFAULT NULL, - `config_default_expense_account` int DEFAULT NULL, - `config_default_payment_method` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_default_expense_payment_method` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_default_calendar` int DEFAULT NULL, - `config_default_net_terms` int DEFAULT NULL, - `config_default_hourly_rate` decimal(15,2) NOT NULL DEFAULT '0.00', - `config_project_prefix` varchar(200) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'PRJ-', - `config_project_next_number` int NOT NULL DEFAULT '1', - `config_invoice_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_invoice_next_number` int DEFAULT NULL, - `config_invoice_footer` text COLLATE utf8mb4_general_ci, - `config_invoice_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_invoice_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_invoice_late_fee_enable` tinyint(1) NOT NULL DEFAULT '0', - `config_invoice_late_fee_percent` decimal(5,2) NOT NULL DEFAULT '0.00', - `config_recurring_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_recurring_next_number` int NOT NULL, - `config_quote_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_quote_next_number` int DEFAULT NULL, - `config_quote_footer` text COLLATE utf8mb4_general_ci, - `config_quote_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_quote_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_ticket_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_ticket_next_number` int DEFAULT NULL, - `config_ticket_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_ticket_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_ticket_email_parse` tinyint(1) NOT NULL DEFAULT '0', - `config_ticket_client_general_notifications` tinyint(1) NOT NULL DEFAULT '1', - `config_ticket_autoclose` tinyint(1) NOT NULL DEFAULT '0', - `config_ticket_autoclose_hours` int NOT NULL DEFAULT '72', - `config_ticket_new_ticket_notification_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_ticket_default_billable` tinyint(1) NOT NULL DEFAULT '0', - `config_enable_cron` tinyint(1) NOT NULL DEFAULT '0', - `config_cron_key` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_recurring_auto_send_invoice` tinyint(1) NOT NULL DEFAULT '1', - `config_enable_alert_domain_expire` tinyint(1) NOT NULL DEFAULT '1', - `config_send_invoice_reminders` tinyint(1) NOT NULL DEFAULT '1', - `config_invoice_overdue_reminders` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_stripe_enable` tinyint(1) NOT NULL DEFAULT '0', - `config_stripe_publishable` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_stripe_secret` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_stripe_account` int NOT NULL DEFAULT '0', - `config_stripe_expense_vendor` int NOT NULL DEFAULT '0', - `config_stripe_expense_category` int NOT NULL DEFAULT '0', - `config_stripe_percentage_fee` decimal(4,4) NOT NULL DEFAULT '0.0290', - `config_ai_enable` tinyint(1) DEFAULT '0', - `config_ai_provider` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_ai_model` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_ai_url` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_ai_api_key` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_stripe_flat_fee` decimal(15,2) NOT NULL DEFAULT '0.30', - `config_stripe_client_pays_fees` tinyint(1) NOT NULL DEFAULT '0', - `config_azure_client_id` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_azure_client_secret` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_module_enable_itdoc` tinyint(1) NOT NULL DEFAULT '1', - `config_module_enable_accounting` tinyint(1) NOT NULL DEFAULT '1', - `config_client_portal_enable` tinyint(1) NOT NULL DEFAULT '1', - `config_login_message` text COLLATE utf8mb4_general_ci, - `config_login_key_required` tinyint(1) NOT NULL DEFAULT '0', - `config_login_key_secret` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, - `config_login_remember_me_expire` int NOT NULL DEFAULT '3', - `config_module_enable_ticketing` tinyint(1) NOT NULL DEFAULT '1', - `config_theme` varchar(200) COLLATE utf8mb4_general_ci DEFAULT 'blue', - `config_telemetry` tinyint(1) DEFAULT '0', - `config_timezone` varchar(200) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'America/New_York', - `config_destructive_deletes_enable` tinyint(1) NOT NULL DEFAULT '0', - `config_phone_mask` tinyint(1) NOT NULL DEFAULT '1', - `config_et_client_app_newaccount` text COLLATE utf8mb4_general_ci, - `config_et_client_app_passwordreset` text COLLATE utf8mb4_general_ci, - `config_et_client_app_passwordresetcomplete` text COLLATE utf8mb4_general_ci, - `config_et_client_calendar_rescheduled` text COLLATE utf8mb4_general_ci, - `config_et_client_calendar_scheduled` text COLLATE utf8mb4_general_ci, - `config_et_client_invoice_new` text COLLATE utf8mb4_general_ci, - `config_et_client_invoice_newrecurring` text COLLATE utf8mb4_general_ci, - `config_et_client_invoice_paymentfull` text COLLATE utf8mb4_general_ci, - `config_et_client_invoice_paymentmultiple` text COLLATE utf8mb4_general_ci, - `config_et_client_invoice_paymentpartial` text COLLATE utf8mb4_general_ci, - `config_et_client_invoice_paymentreminder` text COLLATE utf8mb4_general_ci, - `config_et_client_invoice_paymentstripe` text COLLATE utf8mb4_general_ci, - `config_et_client_quote_new` text COLLATE utf8mb4_general_ci, - `config_et_client_securelink` text COLLATE utf8mb4_general_ci, - `config_et_watcher_notify` text COLLATE utf8mb4_general_ci, - `config_et_client_invoice_paid` text COLLATE utf8mb4_general_ci, - PRIMARY KEY (`company_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- --- Dumping data for table `settings` --- - -INSERT INTO `settings` (`config_et_client_ticket_new`, `config_et_client_ticket_update`, `config_et_client_ticket_autoclose`, `config_et_client_ticket_updatedpendingclosure`, `config_et_client_ticket_closed`, `config_et_client_app_newaccount`, `config_et_client_app_passwordreset`, `config_et_client_app_passwordresetcomplete`, `config_et_client_calendar_rescheduled`, `config_et_client_calendar_scheduled`, `config_et_client_invoice_new`, `config_et_client_invoice_newrecurring`, `config_et_client_invoice_paymentfull`, `config_et_client_invoice_paymentmultiple`, `config_et_client_invoice_paymentpartial`, `config_et_client_invoice_paymentreminder`, `config_et_client_invoice_paymentstripe`, `config_et_client_quote_new`, `config_et_client_securelink`, `config_et_watcher_notify`, `config_et_client_invoice_paid`) VALUES -('<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>New Ticket Created</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name]<br><br><br>If you would like to check the status of your ticket or provide additional information, please respond to this notification.<br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>Ticket Updated</strong><br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Response:</strong> <br><br>[ticket_reply] <br><br><br>If you would like to check the status of your ticket or provide additional information, please respond to this notification <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>Ticket automatic closure notice</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Message:</strong> <br><br>This is an automatic reminder that your ticket will be closed unless you respond. <br>If your issue has been resolved, you can ignore this email and your ticket will close automatically. <br>If you need further assistance with this ticket, please respond to this email. <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>Ticket Updated</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Ticket Pending Closure</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Response:</strong> <br><br>[ticket_reply] <br><br><br>If your issue has been resolved, you can ignore this email and your ticket will close automatically. <br>If you need further assistance with this ticket, please respond to this email. <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>Ticket Closed</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br>Your ticket has been closed. We hope to have fixed your issue.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;<br><strong>Replies to this email will not be received</strong> <br>If you need further assistance, please open a new ticket. <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Account Created</strong><br><br><br><strong>Username:</strong> [username]<br><br><strong>Temporary Password:</strong> [password_info]&nbsp;<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Portal Link :</strong> &nbsp;<a href="https://[config_base_url]/portal/">https://[config_base_url]/portal/</a><br><br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Password Reset Request</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Please <a href="[url]">click here</a> to reset your password.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">If you did not request a password reset, ignore this email.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Password Reset Notification</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Your password for our Support Portal has been reset successfully.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">If you did not request a password reset, please get in touch with us immediately.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br><br>Thank You, <br>[company_name]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[company_phone]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Appointment Rescheduled</strong><br><br><br><strong>Title:</strong> [title]<br><br><strong>Appointment Date:</strong> [start]&nbsp;<br><br><strong>Contact:</strong> [contact_name] <br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Appointment Scheduled</strong><br><br><br><strong>Title:</strong> [title]<br><br><strong>Appointment Date:</strong> [start]&nbsp;<br><br><strong>Contact:</strong> [contact_name] <br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice from [company_name]</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Title:&nbsp;</strong>[invoice_scope]<br><br><strong>Invoice Date:</strong> [invoice_date]&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date:&nbsp;</strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>New Invoice</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Title:&nbsp;</strong>[invoice_scope]<br><br><strong>Invoice Date:</strong> [invoice_date]&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date:&nbsp;</strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[new_invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payment Received</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[total_payments_amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[invoice_balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payments Received</strong><br><br><br><strong>Payment Details:</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[email_body_invoices]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Partial Payment Received</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[invoice_balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Unpaid Invoice Reminder</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]&nbsp;<br><br><strong>Invoice Date:</strong> [invoice_date]&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date:&nbsp;</strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Our records indicate that we have not yet received payment for this invoice. We kindly request that you submit your payment as soon as possible.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">To view your invoice, please&nbsp;<a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payment Received</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> [pi_currency][pi_amount_paid]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>New Quote</strong><br><br><br><strong>Title:</strong> [quote_scope]&nbsp;<br><br><strong>Total Amount:</strong> $[quote_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view and accept your quote, please&nbsp;<a href="https://[config_base_url]/guest_view_quote.php?quote_id=[quote_id]&amp;url_key=[quote_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Please contact us with any questions or concerns.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[session_name] from [company name] has shared a secure link with you</strong><br><br><br><strong>Expires In:</strong> [item_expires_friendly]<br><br><strong>View Count Limit:</strong> [item_view_limit]&nbsp;<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Link :</strong> <a href="[url]">Click Here</a>&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>After the expiration time the above link will no longer work. You may want to record the linked content elsewhere, such as a password manager.&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><em style="color: #808080;">##- Please type your reply above this line -##</em> <br><br><br><strong>Ticket Watcher Notification</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">You are now a Watcher on this ticket.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Ticket Details:</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[ticket_details]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Paid</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[amount_paid]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[new_invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>'); -COMMIT; - -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/email-templates-sample.sql b/email-templates-sample.sql new file mode 100644 index 000000000..6d8a19401 --- /dev/null +++ b/email-templates-sample.sql @@ -0,0 +1,172 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.1 +-- https://www.phpmyadmin.net/ +-- +-- Host: 127.0.0.1:3306 +-- Generation Time: Jun 30, 2024 at 04:49 PM +-- Server version: 8.3.0 +-- PHP Version: 8.2.18 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `itflow` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `settings` +-- + +DROP TABLE IF EXISTS `settings`; +CREATE TABLE IF NOT EXISTS `settings` ( + `company_id` int NOT NULL, + `config_current_database_version` varchar(10) COLLATE utf8mb4_general_ci NOT NULL, + `config_start_page` varchar(200) COLLATE utf8mb4_general_ci DEFAULT 'clients.php', + `config_smtp_host` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_smtp_port` int DEFAULT NULL, + `config_smtp_encryption` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_smtp_username` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_smtp_password` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_mail_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_mail_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_imap_host` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_imap_port` int DEFAULT NULL, + `config_imap_encryption` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_imap_username` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_imap_password` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_et_client_ticket_new` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_update` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_autoclose` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_updatedpendingclosure` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_closed` text COLLATE utf8mb4_general_ci, + `config_default_transfer_from_account` int DEFAULT NULL, + `config_default_transfer_to_account` int DEFAULT NULL, + `config_default_payment_account` int DEFAULT NULL, + `config_default_expense_account` int DEFAULT NULL, + `config_default_payment_method` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_default_expense_payment_method` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_default_calendar` int DEFAULT NULL, + `config_default_net_terms` int DEFAULT NULL, + `config_default_hourly_rate` decimal(15,2) NOT NULL DEFAULT '0.00', + `config_project_prefix` varchar(200) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'PRJ-', + `config_project_next_number` int NOT NULL DEFAULT '1', + `config_invoice_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_invoice_next_number` int DEFAULT NULL, + `config_invoice_footer` text COLLATE utf8mb4_general_ci, + `config_invoice_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_invoice_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_invoice_late_fee_enable` tinyint(1) NOT NULL DEFAULT '0', + `config_invoice_late_fee_percent` decimal(5,2) NOT NULL DEFAULT '0.00', + `config_recurring_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_recurring_next_number` int NOT NULL, + `config_quote_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_quote_next_number` int DEFAULT NULL, + `config_quote_footer` text COLLATE utf8mb4_general_ci, + `config_quote_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_quote_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ticket_prefix` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ticket_next_number` int DEFAULT NULL, + `config_ticket_from_name` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ticket_from_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ticket_email_parse` tinyint(1) NOT NULL DEFAULT '0', + `config_ticket_client_general_notifications` tinyint(1) NOT NULL DEFAULT '1', + `config_ticket_autoclose` tinyint(1) NOT NULL DEFAULT '0', + `config_ticket_autoclose_hours` int NOT NULL DEFAULT '72', + `config_ticket_new_ticket_notification_email` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ticket_default_billable` tinyint(1) NOT NULL DEFAULT '0', + `config_enable_cron` tinyint(1) NOT NULL DEFAULT '0', + `config_cron_key` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_recurring_auto_send_invoice` tinyint(1) NOT NULL DEFAULT '1', + `config_enable_alert_domain_expire` tinyint(1) NOT NULL DEFAULT '1', + `config_send_invoice_reminders` tinyint(1) NOT NULL DEFAULT '1', + `config_invoice_overdue_reminders` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_stripe_enable` tinyint(1) NOT NULL DEFAULT '0', + `config_stripe_publishable` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_stripe_secret` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_stripe_account` int NOT NULL DEFAULT '0', + `config_stripe_expense_vendor` int NOT NULL DEFAULT '0', + `config_stripe_expense_category` int NOT NULL DEFAULT '0', + `config_stripe_percentage_fee` decimal(4,4) NOT NULL DEFAULT '0.0290', + `config_ai_enable` tinyint(1) DEFAULT '0', + `config_ai_provider` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ai_model` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ai_url` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_ai_api_key` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_stripe_flat_fee` decimal(15,2) NOT NULL DEFAULT '0.30', + `config_stripe_client_pays_fees` tinyint(1) NOT NULL DEFAULT '0', + `config_azure_client_id` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_azure_client_secret` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_module_enable_itdoc` tinyint(1) NOT NULL DEFAULT '1', + `config_module_enable_accounting` tinyint(1) NOT NULL DEFAULT '1', + `config_client_portal_enable` tinyint(1) NOT NULL DEFAULT '1', + `config_login_message` text COLLATE utf8mb4_general_ci, + `config_login_key_required` tinyint(1) NOT NULL DEFAULT '0', + `config_login_key_secret` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, + `config_login_remember_me_expire` int NOT NULL DEFAULT '3', + `config_module_enable_ticketing` tinyint(1) NOT NULL DEFAULT '1', + `config_theme` varchar(200) COLLATE utf8mb4_general_ci DEFAULT 'blue', + `config_telemetry` tinyint(1) DEFAULT '0', + `config_timezone` varchar(200) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'America/New_York', + `config_destructive_deletes_enable` tinyint(1) NOT NULL DEFAULT '0', + `config_phone_mask` tinyint(1) NOT NULL DEFAULT '1', + `config_et_client_app_newaccount` text COLLATE utf8mb4_general_ci, + `config_et_client_app_passwordreset` text COLLATE utf8mb4_general_ci, + `config_et_client_app_passwordresetcomplete` text COLLATE utf8mb4_general_ci, + `config_et_client_calendar_rescheduled` text COLLATE utf8mb4_general_ci, + `config_et_client_calendar_scheduled` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_new` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_newrecurring` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentfull` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentmultiple` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentpartial` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentreminder` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentstripe` text COLLATE utf8mb4_general_ci, + `config_et_client_quote_new` text COLLATE utf8mb4_general_ci, + `config_et_client_securelink` text COLLATE utf8mb4_general_ci, + `config_et_watcher_notify` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paid` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_new_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_update_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_autoclose_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_updatedpendingclosure_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_ticket_closed_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_app_newaccount_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_app_passwordreset_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_app_passwordresetcomplete_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_calendar_rescheduled_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_calendar_scheduled_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_new_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_newrecurring_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paid_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentfull_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentmultiple_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentpartial_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentreminder_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_invoice_paymentstripe_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_quote_new_subj` text COLLATE utf8mb4_general_ci, + `config_et_client_securelink_subj` text COLLATE utf8mb4_general_ci, + `config_et_watcher_notify_subj` text COLLATE utf8mb4_general_ci, + PRIMARY KEY (`company_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `settings` +-- + +INSERT INTO `settings` (`config_et_client_ticket_new`, `config_et_client_ticket_update`, `config_et_client_ticket_autoclose`, `config_et_client_ticket_updatedpendingclosure`, `config_et_client_ticket_closed`, `config_et_client_app_newaccount`, `config_et_client_app_passwordreset`, `config_et_client_app_passwordresetcomplete`, `config_et_client_calendar_rescheduled`, `config_et_client_calendar_scheduled`, `config_et_client_invoice_new`, `config_et_client_invoice_newrecurring`, `config_et_client_invoice_paymentfull`, `config_et_client_invoice_paymentmultiple`, `config_et_client_invoice_paymentpartial`, `config_et_client_invoice_paymentreminder`, `config_et_client_invoice_paymentstripe`, `config_et_client_quote_new`, `config_et_client_securelink`, `config_et_watcher_notify`, `config_et_client_invoice_paid`, `config_et_client_ticket_new_subj`, `config_et_client_ticket_update_subj`, `config_et_client_ticket_autoclose_subj`, `config_et_client_ticket_updatedpendingclosure_subj`, `config_et_client_ticket_closed_subj`, `config_et_client_app_newaccount_subj`, `config_et_client_app_passwordreset_subj`, `config_et_client_app_passwordresetcomplete_subj`, `config_et_client_calendar_rescheduled_subj`, `config_et_client_calendar_scheduled_subj`, `config_et_client_invoice_new_subj`, `config_et_client_invoice_newrecurring_subj`, `config_et_client_invoice_paid_subj`, `config_et_client_invoice_paymentfull_subj`, `config_et_client_invoice_paymentmultiple_subj`, `config_et_client_invoice_paymentpartial_subj`, `config_et_client_invoice_paymentreminder_subj`, `config_et_client_invoice_paymentstripe_subj`, `config_et_client_quote_new_subj`, `config_et_client_securelink_subj`, `config_et_watcher_notify_subj`) VALUES +('<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>New Ticket Created</strong><br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name]<br><br><br>If you would like to check the status of your ticket or provide additional information, please respond to this notification.<br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Ticket Updated</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Response:</strong> <br><br>[ticket_reply] <br><br><br>If you would like to check the status of your ticket or provide additional information, please respond to this notification <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Ticket Pending Closure</strong><br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Message:</strong> <br><br>This is an automatic reminder that your ticket will be closed unless you respond. <br>If your issue has been resolved, you can ignore this email and your ticket will close automatically. <br>If you need further assistance with this ticket, please respond to this email. <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Ticket Updated</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Ticket Pending Closure</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br><br><strong>Response:</strong> <br><br>[ticket_reply] <br><br><br>If your issue has been resolved, you can ignore this email and your ticket will close automatically. <br>If you need further assistance with this ticket, please respond to this email. <br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Ticket Closed</strong> <br><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject] <br><br><strong>Contact:</strong> [contact_name] <br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>Your ticket has been closed. We hope to have fixed your issue.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;<br><strong>Replies to this email will not be received</strong> <br>If you need further assistance, please open a new ticket.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Account Created</strong><br><br><br><strong>Username:</strong> [username]<br><br><strong>Temporary Password:</strong> [password_info]&nbsp;<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Portal Link :</strong> &nbsp;<a href="https://[config_base_url]/portal/">https://[config_base_url]/portal/</a><br><br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Password Reset Request</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Please <a href="[url]">click here</a> to reset your password.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">If you did not request a password reset, ignore this email.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[company_name] Support Portal</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Password Reset Notification</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Your password for our Support Portal has been reset successfully.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">If you did not request a password reset, please get in touch with us immediately.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br><br>Thank You, <br>[company_name]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[company_phone]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Appointment Rescheduled</strong><br><br><br><strong>Title:</strong> [title]<br><br><strong>Appointment Date:</strong> [start]&nbsp;<br><br><strong>Contact:</strong> [contact_name] <br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Appointment Scheduled</strong><br><br><br><strong>Title:</strong> [title]<br><br><strong>Appointment Date:</strong> [start]&nbsp;<br><br><strong>Contact:</strong> [contact_name] <br><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice from [company_name]</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Title:&nbsp;</strong>[invoice_scope]<br><br><strong>Invoice Date:</strong> [invoice_date]&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date:&nbsp;</strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice from [company_name]</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Title:&nbsp;</strong>[invoice_scope]<br><br><strong>Invoice Date:</strong> [invoice_date]&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date:&nbsp;</strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[new_invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payment Received</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[total_payments_amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[invoice_balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payments Received</strong><br><br><br><strong>Payment Details:</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[email_body_invoices]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Partial Payment Received</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[invoice_balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Unpaid Invoice Reminder</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]&nbsp;<br><br><strong>Invoice Date:</strong> [invoice_date]&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Due Date:&nbsp;</strong>[invoice_due]<br><br><strong>Total Amount:</strong> $[invoice_amount]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Our records indicate that we have not yet received payment for this invoice. We kindly request that you submit your payment as soon as possible.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">To view your invoice, please&nbsp;<a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Payment Received</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> [pi_currency][pi_amount_paid]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>New Quote from [company_name]</strong><br><br><br><strong>Title:</strong> [quote_scope]&nbsp;<br><br><strong>Total Amount:</strong> $[quote_amount]<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view and accept your quote, please&nbsp;<a href="https://[config_base_url]/guest_view_quote.php?quote_id=[quote_id]&amp;url_key=[quote_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Please contact us with any questions or concerns.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>[session_name] from [company name] has shared a secure link with you</strong><br><br><br><strong>Expires In:</strong> [item_expires_friendly]<br><br><strong>View Count Limit:</strong> [item_view_limit]&nbsp;<br><br></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Link :</strong> <a href="[url]">Click Here</a>&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>After the expiration time the above link will no longer work. You may want to record the linked content elsewhere, such as a password manager.&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Ticket Watcher Notification</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><strong>Ticket Number:</strong> [ticket_prefix][ticket_number] <br><br><strong>Title:</strong> [ticket_subject]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">You are now a Watcher on this ticket.</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Ticket Details:</strong></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">[ticket_details]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br><br>Thank You, <br>[company_name]</p>', '<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><strong>Invoice Paid</strong><br><br><br><strong>Invoice Number:</strong> [invoice_prefix][invoice_number]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Invoice Date:</strong> [invoice_date]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Payment Amount:</strong> $[amount_paid]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><strong>Balance Due:</strong> $[balance]</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br>To view your invoice, please <a href="https://[config_base_url]/guest_view_invoice.php?invoice_id=[new_invoice_id]&amp;url_key=[invoice_url_key]">click here.</a></p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">Thank you for your business!</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;">&nbsp;</p>\r\n<p style="font-family: arial; line-height: 15pt; letter-spacing: .65pt; color: #2b2b2e;"><br><br>Thank You, <br>[company_name]</p>', '[[ticket_prefix][ticket_number]] - [ticket_subject] - Ticket Created', '[[ticket_prefix][ticket_number]] - [ticket_subject] - Ticket Updated', '[[ticket_prefix][ticket_number]] - [ticket_subject] - Ticket Pending Closure', '[[ticket_prefix][ticket_number]] - [ticket_subject] - Ticket Pending Closure', '[[ticket_prefix][ticket_number]] - [ticket_subject] - Ticket Closed', '[company_name] Support Portal - New Account Created', '[company_name] Support Portal - Password Reset Request', '[company_name] Support Portal - Password Reset Successfully', '[company_name] - Appointment Rescheduled', '[company_name] - Appointment Scheduled', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice Payment Received', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice Payment Received', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice Payment Received', '[[invoice_prefix][invoice_number]] - [company_name] - Partial Invoice Payment Received', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice Reminder', '[[invoice_prefix][invoice_number]] - [company_name] - Invoice Payment Received', '[[quote_prefix][quote_number]] - [company_name] Quote - [quote_scope]', 'Secure Link from [company_name]', '[[ticket_prefix][ticket_number]] - Ticket Watcher Notification'); +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; From 7a6545e20dbb4f23d1efa2199e68776b189dd29f Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Sun, 30 Jun 2024 13:15:09 -0400 Subject: [PATCH 09/14] Added missing shortcodes --- functions.php | 13 ++++++++++++- settings_mail.php | 9 +++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/functions.php b/functions.php index ae557d978..458e5cd18 100644 --- a/functions.php +++ b/functions.php @@ -788,7 +788,18 @@ function prepareEmailTemplateTags($emailTemplateTags) 'start', 'title', 'ticket_reply', - 'company_phone' + 'company_phone', + 'total_payments_amount', + 'invoice_balance', + 'invoice_scope', + 'invoice_due', + 'amount_paid', + 'balance', + 'email_body_invoices', + 'pi_currency', + 'pi_amount_paid' + + ]; // Perform variable substitution for double-bracketed tags [[this]] or [[this][that]] diff --git a/settings_mail.php b/settings_mail.php index 2d30e189b..7bdcd3d43 100644 --- a/settings_mail.php +++ b/settings_mail.php @@ -471,11 +471,20 @@ {type: 'menuitem', text: 'Contact Email', onAction: () => editor.insertContent(`[contact_email]`)}, {type: 'menuitem', text: 'Contact Name', onAction: () => editor.insertContent(`[contact_name]`)}, {type: 'menuitem', text: 'Invoice Amount', onAction: () => editor.insertContent(`[invoice_amount]`)}, + {type: 'menuitem', text: 'Invoice Amount Paid', onAction: () => editor.insertContent(`[amount_paid]`)}, + {type: 'menuitem', text: 'Invoice Balance', onAction: () => editor.insertContent(`[invoice_balance]`)}, + {type: 'menuitem', text: 'Invoice Balance 2', onAction: () => editor.insertContent(`[balance]`)}, {type: 'menuitem', text: 'Invoice Date', onAction: () => editor.insertContent(`[invoice_date]`)}, + {type: 'menuitem', text: 'Invoice Due Date', onAction: () => editor.insertContent(`[invoice_due]`)}, {type: 'menuitem', text: 'Invoice Number', onAction: () => editor.insertContent(`[invoice_number]`)}, + {type: 'menuitem', text: 'Invoice Scope', onAction: () => editor.insertContent(`[invoice_scope]`)}, + {type: 'menuitem', text: 'Invoice Total Payments Amount', onAction: () => editor.insertContent(`[total_payments_amount]`)}, {type: 'menuitem', text: 'Invoice Prefix', onAction: () => editor.insertContent(`[invoice_prefix]`)}, {type: 'menuitem', text: 'Invoice URL Key', onAction: () => editor.insertContent(`[invoice_url_key]`)}, {type: 'menuitem', text: 'Invoice URL', onAction: () => editor.insertContent(`https://[config_base_url]/guest_view_invoice.php?invoice_id=[invoice_id]&url_key=[invoice_url_key]`)}, + {type: 'menuitem', text: 'Multiple Invoice Summary', onAction: () => editor.insertContent(`[email_body_invoices]`)}, + {type: 'menuitem', text: 'Stripe Currency Type', onAction: () => editor.insertContent(`[pi_currency]`)}, + {type: 'menuitem', text: 'Stripe Amount Paid', onAction: () => editor.insertContent(`[pi_amount]`)}, ]} ); editor.ui.registry.addNestedMenuItem('quotesub', { From 8b9bafacdf56f589a76bece96d001c7b44d77114 Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Mon, 22 Jul 2024 19:22:18 -0400 Subject: [PATCH 10/14] Added missing tags --- functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions.php b/functions.php index 458e5cd18..e9d70a32f 100644 --- a/functions.php +++ b/functions.php @@ -797,7 +797,9 @@ function prepareEmailTemplateTags($emailTemplateTags) 'balance', 'email_body_invoices', 'pi_currency', - 'pi_amount_paid' + 'pi_amount_paid', + 'invoice_id', + 'quote_id' ]; From 67463b00bacfe6039fbef65893eee1397b13cd7a Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Wed, 4 Sep 2024 16:56:07 -0400 Subject: [PATCH 11/14] Update guest_pay_invoice_stripe.php --- guest_pay_invoice_stripe.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guest_pay_invoice_stripe.php b/guest_pay_invoice_stripe.php index f1a9a6e80..8ca4c2f4b 100644 --- a/guest_pay_invoice_stripe.php +++ b/guest_pay_invoice_stripe.php @@ -354,8 +354,8 @@ function log_to_console($message) { $config_base_url = sanitizeInput($config_base_url); // Get Email Template - $config_et_client_invoice_paymentstripe = prepareEmailTemplate($config_et_client_invoice_paymentstripe); - $config_et_client_invoice_paymentstripe_subj = prepareEmailTemplateTags($config_et_client_invoice_paymentstripe_subj); + $config_et_client_invoice_paymentstripe = prepareEmailTemplate($row['config_et_client_invoice_paymentstripe']); + $config_et_client_invoice_paymentstripe_subj = prepareEmailTemplateTags($row['config_et_client_invoice_paymentstripe_subj']); if (!empty($config_smtp_host)) { $subject = "$config_et_client_invoice_paymentstripe_subj"; From 2d9c4e3fe3311b99c15cc7d21d18395ce34268cd Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Wed, 4 Sep 2024 18:59:46 -0400 Subject: [PATCH 12/14] Update functions.php --- functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions.php b/functions.php index 5a5711876..5e9f85630 100644 --- a/functions.php +++ b/functions.php @@ -825,7 +825,9 @@ function prepareEmailTemplateTags($emailTemplateTags) 'pi_currency', 'pi_amount_paid', 'invoice_id', - 'quote_id' + 'quote_id', + 'amount', + 'ticket_status' ]; From 74262ae499d51bd13816a682e044a7a63879c897 Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Wed, 4 Sep 2024 19:02:05 -0400 Subject: [PATCH 13/14] Update cron.php --- cron.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cron.php b/cron.php index 90f80b474..c11a0f34c 100644 --- a/cron.php +++ b/cron.php @@ -443,8 +443,8 @@ $contact_email = sanitizeInput($row['contact_email']); // Get Email Template - $config_et_client_invoice_paymentreminder = prepareEmailTemplate($config_et_client_invoice_paymentreminder); - $config_et_client_invoice_paymentreminder_subj = prepareEmailTemplateTags($config_et_client_invoice_paymentreminder_subj); + $config_et_client_invoice_paymentreminder = prepareEmailTemplate($row['$config_et_client_invoice_paymentreminder']); + $config_et_client_invoice_paymentreminder_subj = prepareEmailTemplateTags($row['config_et_client_invoice_paymentreminder_subj']); // Late Charges @@ -587,8 +587,8 @@ $contact_email = sanitizeInput($row['contact_email']); // Get Email Template - $config_et_client_invoice_newrecurring = prepareEmailTemplate($config_et_client_invoice_newrecurring); - $config_et_client_invoice_newrecurring_subj = prepareEmailTemplateTags($config_et_client_invoice_newrecurring_subj); + $config_et_client_invoice_newrecurring = prepareEmailTemplater($row['config_et_client_invoice_newrecurring']); + $config_et_client_invoice_newrecurring_subj = prepareEmailTemplateTags($row['config_et_client_invoice_newrecurring_subj']); $subject = "$config_et_client_invoice_newrecurring_subj"; $body = "$config_et_client_invoice_newrecurring"; From e7aa3bc86b99f785ffa3e31d90a3d523ed63937e Mon Sep 17 00:00:00 2001 From: jack-10000 Date: Tue, 1 Oct 2024 07:53:58 -0400 Subject: [PATCH 14/14] Update functions.php --- functions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/functions.php b/functions.php index 5e9f85630..898943774 100644 --- a/functions.php +++ b/functions.php @@ -825,6 +825,7 @@ function prepareEmailTemplateTags($emailTemplateTags) 'pi_currency', 'pi_amount_paid', 'invoice_id', + 'new_invoice_id', 'quote_id', 'amount', 'ticket_status'