Format the date and time in fax logs with timezone

Updated SQL query to format fax date and time with timezone. Adjusted output to display formatted date and time in the fax logs.
This commit is contained in:
FusionPBX
2025-11-18 14:00:20 -07:00
committed by GitHub
parent 21b85d0316
commit 0d4887affd

View File

@@ -89,6 +89,7 @@
$parameters['domain_uuid'] = $domain_uuid;
$parameters['fax_uuid'] = $fax_uuid;
$num_rows = $database->select($sql, $parameters, 'column');
unset($sql, $parameters);
//prepare to page the results
$rows_per_page = $settings->get('domain', 'paging', 50);
@@ -100,10 +101,44 @@
$offset = $rows_per_page * $page;
}
echo " <td><a href='".$list_row_url."'>".(!empty($settings->get('domain', 'time_format')) && $settings->get('domain', 'time_format') == '12h' ? date("j M Y g:i:sa", $row['fax_epoch']) : date("j M Y H:i:s", $row['fax_epoch']))."</a>&nbsp;</td>\n";
//set the time zone
$time_zone = $settings->get('domain', 'time_zone', date_default_timezone_get());
//set time format
$time_format = $settings->get('domain', 'time_format');
//get the list
$sql = str_replace('count(fax_log_uuid)', '*', $sql);
$sql = "select ";
$sql .= " fax_epoch, ";
$sql .= " to_char(timezone(:time_zone, to_timestamp(fax_epoch)), 'DD Mon YYYY') as fax_date_formatted, \n";
$sql .= " to_char(timezone(:time_zone, to_timestamp(fax_epoch)), 'HH12:MI:SS am') as fax_time_formatted, \n";
$sql .= " fax_success, ";
$sql .= " fax_result_code, ";
$sql .= " fax_result_text, ";
$sql .= " fax_file, ";
$sql .= " fax_ecm_used, ";
$sql .= " fax_local_station_id, ";
//$sql .= " fax_document_transferred_pages, ";
//$sql .= " fax_document_total_pages, ";
//$sql .= " fax_image_resolution, ";
//$sql .= " fax_image_size, ";
$sql .= " fax_bad_rows, ";
$sql .= " fax_transfer_rate, ";
$sql .= " fax_retry_attempts, ";
$sql .= " fax_retry_limit, ";
$sql .= " fax_retry_sleep, ";
$sql .= " fax_uri ";
$sql .= "from v_fax_logs ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and fax_uuid = :fax_uuid ";
$sql .= $sql_search ?? '';
$sql .= order_by($order_by, $order, 'fax_epoch', 'desc');
$sql .= limit_offset($rows_per_page, $offset ?? 0);
$parameters['domain_uuid'] = $domain_uuid;
$parameters['fax_uuid'] = $fax_uuid;
$parameters['time_zone'] = $time_zone;
$fax_logs = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
@@ -156,7 +191,8 @@
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".(empty($fax_logs) ? "style='visibility: hidden;'" : null).">\n";
echo " </th>\n";
}
echo th_order_by('fax_epoch', $text['label-fax_date'], $order_by, $order, null, null, "&id=".$fax_uuid);
echo th_order_by('fax_epoch', $text['label-date'], $order_by, $order, null, null, "&id=".$fax_uuid);
echo th_order_by('fax_epoch', $text['label-time'], $order_by, $order, null, null, "&id=".$fax_uuid);
echo th_order_by('fax_success', $text['label-fax_success'], $order_by, $order, null, null, "&id=".$fax_uuid);
echo th_order_by('fax_result_code', $text['label-fax_result_code'], $order_by, $order, null, null, "&id=".$fax_uuid);
echo th_order_by('fax_result_text', $text['label-fax_result_text'], $order_by, $order, null, null, "&id=".$fax_uuid);
@@ -173,7 +209,6 @@
//echo th_order_by('fax_retry_limit', $text['label-fax_retry_limit'], $order_by, $order);
//echo th_order_by('fax_retry_sleep', $text['label-fax_retry_sleep'], $order_by, $order);
echo th_order_by('fax_uri', $text['label-fax_destination'], $order_by, $order, null, null, "&id=".$fax_uuid);
//echo th_order_by('fax_epoch', $text['label-fax_epoch'], $order_by, $order);
if ($settings->get('theme', 'list_row_edit_button', false)) {
echo " <td class='action-button'>&nbsp;</td>\n";
}
@@ -190,7 +225,8 @@
echo " <input type='hidden' name='fax_logs[$x][uuid]' value='".escape($row['fax_log_uuid'])."' />\n";
echo " </td>\n";
}
echo " <td><a href='".$list_row_url."'>".(!empty($settings->get('domain', 'time_format')) && $settings->get('domain', 'time_format') == '12h' ? date("j M Y g:i:sa", $row['fax_epoch']) : date("j M Y H:i:s", $row['fax_epoch']))."</a>&nbsp;</td>\n";
echo " <td><a href='".$list_row_url."'>".$row['fax_date_formatted']."</a>&nbsp;</td>\n";
echo " <td><a href='".$list_row_url."'>".$row['fax_time_formatted']."</a>&nbsp;</td>\n";
echo " <td>".$row['fax_success']."&nbsp;</td>\n";
echo " <td>".$row['fax_result_code']."&nbsp;</td>\n";
echo " <td>".$row['fax_result_text']."&nbsp;</td>\n";