mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-03-31 13:39:55 +00:00
Customize fax confirmation email (#7807)
* Update fax_send.php to get total pages 1. Added the total number of the FAX Introduce a $total_pages variable Include the cover page in the page count ✅ 1. Initialize total pages (NEW) Location: Right before adding the cover page ➤ Added: line 425 $total_pages = $fax_page_count; 📌 Meaning: Starts total count with attachment pages (same as original behaviour baseline) ✅ 2. Replace original page display logic ❌ Original code: if ($fax_page_count > 0) { $pdf->Text($x + 2.0, $y + 2.6, $fax_page_count.' '.$text['label-fax-page'.(($fax_page_count > 1) ? 's' : null)]); } ✅ Replacement: line 560 $total_pages = $fax_page_count + 1; // 1 = cover page $pdf->Text( $x + 2.0, $y + 2.6, $total_pages.' '.$text['label-fax-page'.(($total_pages > 1) ? 's' : null)] ); 📌 Meaning: Adds +1 for cover page Always shows total pages instead of just attachments Removes conditional (if ($fax_page_count > 0)) ✅ 3. Handle multi-page cover message (NEW) Location: After: $pages = $pdf->getNumPages(); ➤ Added: line 583 $total_pages += $pages; 📌 Meaning: If your cover page expands into multiple pages (long message), those pages are added to total This is important edge-case handling (nice touch 👍) 🧠 Behaviour Change (Before vs After) ❌ Before: Only counted attachment pages Ignored cover page Display could be misleading ✅ After: Counts: Attachments Cover page Extra cover pages (if message is long) Displays true total fax pages * Update fax_send.php to get fax_retry_date Expose and display the fax retry date/time inside email notifications by: Pulling it from the database Injecting it into the email template using a variable ✅ 1. Fetch fax_retry_date from the database File Path: /var/www/fusionpbx/app/fax_queue/resources/job/fax_send.php Location: Under //get the fax queue details to send ➤ Added (around line ~228): $fax_retry_date = $row["fax_retry_date"]; 📌 What this does: Extracts fax_retry_date from the v_fax_queue (or related query result) Stores it in a PHP variable for later use ✅ 2. Inject variable into email body Same file: fax_send.php Location: Under //replace variables in email body ➤ Added (around line ~659): $email_body = str_replace('${fax_retry_date}', $fax_retry_date, $email_body); 📌 What this does: Replaces ${fax_retry_date} placeholder in email template Dynamically inserts retry date into outgoing emails * Update fax_send.php * Update fax_send.php * Update fax_send.php --------- Co-authored-by: FusionPBX <markjcrane@gmail.com>
This commit is contained in:
@@ -422,6 +422,7 @@ if (!function_exists('fax_split_dtmf')) {
|
||||
}
|
||||
|
||||
//add blank page
|
||||
$total_pages = $fax_page_count; //Starts total count with attachment pages
|
||||
$pdf->AddPage('P', array($page_width, $page_height));
|
||||
|
||||
// content offset, if necessary
|
||||
@@ -555,9 +556,12 @@ if (!function_exists('fax_split_dtmf')) {
|
||||
$pdf->Write(0.3, format_phone($fax_caller_id_number));
|
||||
}
|
||||
}
|
||||
if ($fax_page_count > 0) {
|
||||
$pdf->Text($x + 2.0, $y + 2.6, $fax_page_count.' '.$text['label-fax-page'.(($fax_page_count > 1) ? 's' : null)]);
|
||||
}
|
||||
//if ($fax_page_count > 0) {
|
||||
//$pdf->Text($x + 2.0, $y + 2.6, $fax_page_count.' '.$text['label-fax-page'.(($fax_page_count > 1) ? 's' : null)]);
|
||||
//}
|
||||
$total_pages = $fax_page_count + 1; // 1 = cover page add in the total
|
||||
$pdf->Text($x + 2.0, $y + 2.6, $total_pages.' '.$text['label-fax-page'.(($total_pages > 1) ? 's' : null)]);
|
||||
|
||||
if (!empty($fax_subject)) {
|
||||
$pdf->Text($x + 2.0, $y + 2.9, $fax_subject);
|
||||
}
|
||||
@@ -572,6 +576,7 @@ if (!function_exists('fax_split_dtmf')) {
|
||||
}
|
||||
|
||||
$pages = $pdf->getNumPages();
|
||||
$total_pages += $pages; // If your cover page expands into multiple pages (long message), those pages are added to total
|
||||
|
||||
if ($pages > 1) {
|
||||
//save ynew for last page
|
||||
|
||||
@@ -225,6 +225,7 @@
|
||||
$fax_accountcode = $row["fax_accountcode"];
|
||||
$fax_command = $row["fax_command"];
|
||||
$fax_toll_allow = $row["fax_toll_allow"];
|
||||
$fax_retry_date = $row["fax_retry_date"];
|
||||
} else {
|
||||
// Notify user using the system logs
|
||||
syslog(E_WARNING, "Fax Send: UUID {$fax_queue_uuid} not found in fax queue");
|
||||
@@ -655,6 +656,7 @@
|
||||
$email_body = str_replace('${fax_date}', date('Y-m-d H:i:s', $fax_epoch), $email_body);
|
||||
$email_body = str_replace('${fax_duration}', $fax_duration, $email_body);
|
||||
$email_body = str_replace('${fax_duration_formatted}', $fax_duration_formatted, $email_body);
|
||||
$email_body = str_replace('${fax_retry_date}', $fax_retry_date, $email_body);
|
||||
|
||||
//send the email
|
||||
if (isset($fax_email_address) && !empty($fax_email_address)) {
|
||||
|
||||
Reference in New Issue
Block a user