From 0d4887affdb882baa0f18027149b8d4a94196a74 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 18 Nov 2025 14:00:20 -0700 Subject: [PATCH] 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. --- app/fax/fax_logs.php | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/app/fax/fax_logs.php b/app/fax/fax_logs.php index f77c48afe7..05daeb0081 100644 --- a/app/fax/fax_logs.php +++ b/app/fax/fax_logs.php @@ -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 " ".(!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']))." \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 " \n"; echo " \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 "  \n"; } @@ -190,7 +225,8 @@ echo " \n"; echo " \n"; } - echo " ".(!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']))." \n"; + echo " ".$row['fax_date_formatted']." \n"; + echo " ".$row['fax_time_formatted']." \n"; echo " ".$row['fax_success']." \n"; echo " ".$row['fax_result_code']." \n"; echo " ".$row['fax_result_text']." \n";