|
306 | 306 | $config_smtp_password = $row['config_smtp_password']; |
307 | 307 | $config_invoice_from_name = sanitizeInput($row['config_invoice_from_name']); |
308 | 308 | $config_invoice_from_email = sanitizeInput($row['config_invoice_from_email']); |
| 309 | + $config_invoice_paid_notification_email = sanitizeInput($row['config_invoice_paid_notification_email']); |
309 | 310 |
|
310 | 311 | $config_base_url = sanitizeInput($config_base_url); |
311 | 312 |
|
312 | 313 | if (!empty($config_smtp_host)) { |
313 | 314 | $subject = "Payment Received - Invoice $invoice_prefix$invoice_number"; |
314 | 315 | $body = "Hello $contact_name,<br><br>We have received your payment in the amount of " . $pi_currency . $pi_amount_paid . " 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, $pi_amount_paid, $invoice_currency_code) . "<br>Balance: " . numfmt_format_currency($currency_format, '0', $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"; |
315 | 316 |
|
316 | | - $data = [ |
317 | | - [ |
318 | | - 'from' => $config_invoice_from_email, |
319 | | - 'from_name' => $config_invoice_from_name, |
320 | | - 'recipient' => $contact_email, |
321 | | - 'recipient_name' => $contact_name, |
322 | | - 'subject' => $subject, |
323 | | - 'body' => $body, |
324 | | - ] |
| 317 | + $data = [ |
| 318 | + [ |
| 319 | + 'from' => $config_invoice_from_email, |
| 320 | + 'from_name' => $config_invoice_from_name, |
| 321 | + 'recipient' => $contact_email, |
| 322 | + 'recipient_name' => $contact_name, |
| 323 | + 'subject' => $subject, |
| 324 | + 'body' => $body, |
| 325 | + ] |
| 326 | + ]; |
| 327 | + |
| 328 | + |
| 329 | + // Email the internal notification address too |
| 330 | + if (!empty($config_invoice_paid_notification_email)) { |
| 331 | + $subject = "Payment Received - $client_name - Invoice $invoice_prefix$invoice_number"; |
| 332 | + $body = "Hello, <br><br>This is a notification that an invoice has been paid in ITFlow. Below is a copy of the receipt sent to the client:-<br><br>--------<br><br>Hello $contact_name,<br><br>We have received your payment in the amount of " . $pi_currency . $pi_amount_paid . " 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, $pi_amount_paid, $invoice_currency_code) . "<br>Balance: " . numfmt_format_currency($currency_format, '0', $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"; |
| 333 | + |
| 334 | + $data[] = [ |
| 335 | + 'from' => $config_invoice_from_email, |
| 336 | + 'from_name' => $config_invoice_from_name, |
| 337 | + 'recipient' => $config_invoice_paid_notification_email, |
| 338 | + 'recipient_name' => $contact_name, |
| 339 | + 'subject' => $subject, |
| 340 | + 'body' => $body, |
325 | 341 | ]; |
| 342 | + } |
| 343 | + |
326 | 344 | $mail = addToMailQueue($mysqli, $data); |
327 | 345 |
|
328 | 346 | // Email logging |
|
0 commit comments