mirror of
https://github.com/itflow-org/itflow
synced 2026-03-02 20:04:53 +00:00
Ticketing (and Invoicing)
- Hide the ability to add/delete watchers when a ticket is closed - Hide watchers card entirely when tickets are closed, if the ticket had no watchers - Hide the ability to schedule a ticket when a ticket is closed - Don't include tickets in an auto-close state in the sidebar ticket counts - Small edit to the ticket closure wording to account for requests and issues - Small edits to invoice emails text
This commit is contained in:
@@ -288,7 +288,7 @@ if (isset($_POST['add_recurring_item'])) {
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO invoice_items SET item_name = '$name', item_description = '$description', item_quantity = $qty, item_price = $price, item_subtotal = $subtotal, item_tax = $tax_amount, item_total = $total, item_tax_id = $tax_id, item_order = $item_order, item_recurring_id = $recurring_id");
|
||||
|
||||
//Get Discount
|
||||
//Get Discount
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM recurring WHERE recurring_id = $recurring_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
@@ -461,7 +461,7 @@ if (isset($_POST['add_invoice_item'])) {
|
||||
} else {
|
||||
$invoice_discount = 0;
|
||||
}
|
||||
|
||||
|
||||
//add up all line items
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id");
|
||||
$invoice_total = 0;
|
||||
@@ -674,7 +674,7 @@ if (isset($_POST['add_payment'])) {
|
||||
|
||||
if ($email_receipt == 1) {
|
||||
|
||||
$subject = "Payment Received - Invoice $invoice_prefix$invoice_number";
|
||||
$subject = "$company_name Payment Received - Invoice $invoice_prefix$invoice_number";
|
||||
$body = "Hello $contact_name,<br><br>We have received your payment in the amount of " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . " for invoice <a href=\'https://$config_base_url/guest_view_invoice.php?invoice_id=$invoice_id&url_key=$invoice_url_key\'>$invoice_prefix$invoice_number</a>. Please keep this email as a receipt for your records.<br><br>Amount: " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . "<br>Balance: " . numfmt_format_currency($currency_format, $invoice_balance, $invoice_currency_code) . "<br><br>Thank you for your business!<br><br><br>--<br>$company_name - Billing Department<br>$config_invoice_from_email<br>$company_phone";
|
||||
|
||||
// Queue Mail
|
||||
@@ -706,9 +706,8 @@ if (isset($_POST['add_payment'])) {
|
||||
|
||||
if ($email_receipt == 1) {
|
||||
|
||||
|
||||
$subject = "Partial Payment Recieved - Invoice $invoice_prefix$invoice_number";
|
||||
$body = "Hello $contact_name,<br><br>We have recieved partial payment in the amount of " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . " and it has been applied to invoice <a href=\'https://$config_base_url/guest_view_invoice.php?invoice_id=$invoice_id&url_key=$invoice_url_key\'>$invoice_prefix$invoice_number</a>. Please keep this email as a receipt for your records.<br><br>Amount: " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . "<br>Balance: " . numfmt_format_currency($currency_format, $invoice_balance, $invoice_currency_code) . "<br><br>Thank you for your business!<br><br><br>~<br>$company_name - Billing<br>$config_invoice_from_email<br>$company_phone";
|
||||
$subject = "$company_name Partial Payment Received - Invoice $invoice_prefix$invoice_number";
|
||||
$body = "Hello $contact_name,<br><br>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 <a href=\'https://$config_base_url/guest_view_invoice.php?invoice_id=$invoice_id&url_key=$invoice_url_key\'>$invoice_prefix$invoice_number</a>. Please keep this email as a receipt for your records.<br><br>Amount: " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . "<br>Balance: " . numfmt_format_currency($currency_format, $invoice_balance, $invoice_currency_code) . "<br><br>Thank you for your business!<br><br><br>~<br>$company_name - Billing<br>$config_invoice_from_email<br>$company_phone";
|
||||
|
||||
// Queue Mail
|
||||
$email = [
|
||||
@@ -813,7 +812,7 @@ if (isset($_POST['add_bulk_payment'])) {
|
||||
$payment_amount = $bulk_payment_amount;
|
||||
$invoice_status = "Partial";
|
||||
}
|
||||
|
||||
|
||||
// Subtract the payment amount from the bulk payment amount
|
||||
$bulk_payment_amount -= $payment_amount;
|
||||
|
||||
@@ -879,7 +878,7 @@ if (isset($_POST['add_bulk_payment'])) {
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Payment', log_action = 'Email', log_description = 'Bulk Payment receipt for multiple Invoices queued to $contact_email Email ID: $email_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $payment_id");
|
||||
|
||||
$_SESSION['alert_message'] .= "Email receipt sent and ";
|
||||
|
||||
|
||||
} // End Email
|
||||
|
||||
// Logging
|
||||
@@ -950,6 +949,7 @@ if (isset($_GET['email_invoice'])) {
|
||||
$invoice_id = intval($row['invoice_id']);
|
||||
$invoice_prefix = sanitizeInput($row['invoice_prefix']);
|
||||
$invoice_number = intval($row['invoice_number']);
|
||||
$invoice_scope = sanitizeInput($row['invoice_scope']);
|
||||
$invoice_status = sanitizeInput($row['invoice_status']);
|
||||
$invoice_date = sanitizeInput($row['invoice_date']);
|
||||
$invoice_due = sanitizeInput($row['invoice_due']);
|
||||
@@ -989,11 +989,11 @@ if (isset($_GET['email_invoice'])) {
|
||||
$balance = $invoice_amount - $amount_paid;
|
||||
|
||||
if ($invoice_status == 'Paid') {
|
||||
$subject = "Invoice $invoice_prefix$invoice_number Receipt";
|
||||
$body = "Hello $contact_name,<br><br>Please click on the link below to see your invoice marked <b>paid</b>.<br><br><a href=\'https://$config_base_url/guest_view_invoice.php?invoice_id=$invoice_id&url_key=$invoice_url_key\'>Invoice Link</a><br><br><br>--<br>$company_name - Billing<br>$config_invoice_from_email<br>$company_phone";
|
||||
$subject = "$company_name Invoice $invoice_prefix$invoice_number Receipt";
|
||||
$body = "Hello $contact_name,<br><br>Please click on the link below to see your invoice regarding \"$invoice_scope\" marked <b>paid</b>.<br><br><a href=\'https://$config_base_url/guest_view_invoice.php?invoice_id=$invoice_id&url_key=$invoice_url_key\'>Invoice Link</a><br><br><br>--<br>$company_name - Billing<br>$config_invoice_from_email<br>$company_phone";
|
||||
} else {
|
||||
$subject = "Invoice $invoice_prefix$invoice_number";
|
||||
$body = "Hello $contact_name,<br><br>Please view the details of the invoice below.<br><br>Invoice: $invoice_prefix$invoice_number<br>Issue Date: $invoice_date<br>Total: " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . "<br>Balance Due: " . numfmt_format_currency($currency_format, $balance, $invoice_currency_code) . "<br>Due Date: $invoice_due<br><br><br>To view your invoice click <a href=\'https://$config_base_url/guest_view_invoice.php?invoice_id=$invoice_id&url_key=$invoice_url_key\'>here</a><br><br><br>--<br>$company_name - Billing<br>$config_invoice_from_email<br>$company_phone";
|
||||
$subject = "$company_name Invoice $invoice_prefix$invoice_number";
|
||||
$body = "Hello $contact_name,<br><br>Please view the details of your invoice regarding \"$invoice_scope\" below.<br><br>Invoice: $invoice_prefix$invoice_number<br>Issue Date: $invoice_date<br>Total: " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . "<br>Balance Due: " . numfmt_format_currency($currency_format, $balance, $invoice_currency_code) . "<br>Due Date: $invoice_due<br><br><br>To view your invoice, please click <a href=\'https://$config_base_url/guest_view_invoice.php?invoice_id=$invoice_id&url_key=$invoice_url_key\'>here</a>.<br><br><br>--<br>$company_name - Billing<br>$config_invoice_from_email<br>$company_phone";
|
||||
}
|
||||
|
||||
// Queue Mail
|
||||
@@ -1007,7 +1007,7 @@ if (isset($_GET['email_invoice'])) {
|
||||
'body' => $body
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
addToMailQueue($mysqli, $data);
|
||||
|
||||
// Get Email ID for reference
|
||||
@@ -1172,10 +1172,10 @@ if (isset($_GET['force_recurring'])) {
|
||||
|
||||
// Email to client
|
||||
|
||||
$subject = "Invoice $invoice_prefix$invoice_number";
|
||||
$body = "Hello $contact_name,<br><br>Please view the details of the invoice below.<br><br>Invoice: $invoice_prefix$invoice_number<br>Issue Date: $invoice_date<br>Total: $$invoice_amount<br>Due Date: $invoice_due<br><br><br>To view your invoice click <a href=\'https://$config_base_url/guest_view_invoice.php?invoice_id=$new_invoice_id&url_key=$invoice_url_key\'>here</a><br><br><br>--<br>$company_name - Billing<br>$company_phone";
|
||||
$subject = "$company_name Invoice $invoice_prefix$invoice_number";
|
||||
$body = "Hello $contact_name,<br><br>An invoice regarding \"$invoice_scope\" has been generated. Please view the details below.<br><br>Invoice: $invoice_prefix$invoice_number<br>Issue Date: $invoice_date<br>Total: $$invoice_amount<br>Due Date: $invoice_due<br><br><br>To view your invoice, please click <a href=\'https://$config_base_url/guest_view_invoice.php?invoice_id=$new_invoice_id&url_key=$invoice_url_key\'>here</a>.<br><br><br>--<br>$company_name - Billing<br>$company_phone";
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
[
|
||||
'from' => $config_invoice_from_email,
|
||||
@@ -1338,7 +1338,7 @@ if (isset($_POST['export_client_payments_csv'])) {
|
||||
|
||||
|
||||
if (isset($_POST['update_recurring_item_order'])) {
|
||||
|
||||
|
||||
$item_id = intval($_POST['item_id']);
|
||||
$item_recurring_id = intval($_POST['item_recurring_id']);
|
||||
|
||||
@@ -1373,7 +1373,7 @@ if (isset($_POST['update_recurring_item_order'])) {
|
||||
}
|
||||
|
||||
if (isset($_POST['update_invoice_item_order'])) {
|
||||
|
||||
|
||||
$item_id = intval($_POST['item_id']);
|
||||
$item_invoice_id = intval($_POST['item_invoice_id']);
|
||||
|
||||
|
||||
@@ -664,7 +664,7 @@ if (isset($_POST['bulk_close_tickets'])) {
|
||||
$data = [];
|
||||
|
||||
$subject = "Ticket closed - [$ticket_prefix$ticket_number] - $ticket_subject | (do not reply)";
|
||||
$body = "Hello $contact_name,<br><br>Your ticket regarding \"$ticket_subject\" has been closed.<br><br>$details<br><br> We hope the 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. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
$body = "Hello $contact_name,<br><br>Your ticket regarding \"$ticket_subject\" has been closed.<br><br>$details<br><br> 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. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
|
||||
// Email Ticket Contact
|
||||
// Queue Mail
|
||||
@@ -911,10 +911,10 @@ if (isset($_POST['add_ticket_reply'])) {
|
||||
|
||||
if ($ticket_status == 'Closed') {
|
||||
$subject = "Ticket closed - [$ticket_prefix$ticket_number] - $ticket_subject | (do not reply)";
|
||||
$body = "Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been closed.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>We hope the 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. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
$body = "Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been closed.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>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. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
} elseif ($ticket_status == 'Auto Close') {
|
||||
$subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject | (pending closure)";
|
||||
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been updated and is pending closure.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>If your issue is resolved, you can ignore this email. If you need further assistance, please respond! <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been updated and is pending closure.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>If your request/issue is resolved, you can simply ignore this email. If you need further assistance, please respond to let us know! <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
} else {
|
||||
$subject = "Ticket update - [$ticket_prefix$ticket_number] - $ticket_subject";
|
||||
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello $contact_name,<br><br>Your ticket regarding $ticket_subject has been updated.<br><br>--------------------------------<br>$ticket_reply<br>--------------------------------<br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
|
||||
Reference in New Issue
Block a user