mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Use the time_format default setting on more pages (#7663)
* Use the time_format default setting on more pages * Update call_recordings.php * Update devices.php * Update email_queue.php * Update emergency.php * Update time formatting based on settings * Update fax_logs.php * Update fax_queue.php * Update time_condition_edit.php * Update xml_cdr_details.php * Update xml_cdr_search.php * Update xml_cdr_statistics_inc.php * Update xml_cdr_statistics.php * Update xml_cdr.php * Update contact_edit.php * Update contact_notes_view.php * Update contact_notes.php * Update contact_timer.php * Update contact_times.php * Update user_logs.php * Update footer.php * Update template.php * Update fax_files.php * Update recent_calls.php * Update missed_calls.php * Update recordings.php * Update xml_cdr_statistics_inc.php * Update xml_cdr_inc.php * Update xml_cdr_inc.php * Update recordings.php * Update missed_calls.php * Update call_block.php * Update user_logs.php * Update xml_cdr_inc.php * Update xml_cdr_details.php * Update recordings.php * Update fax_queue.php * Update fax_logs.php * Update fax_files.php * Update event_guard_logs.php * Update emergency.php * Update email_queue.php * Update devices.php * Update call_recordings.php * Update time_condition_edit.php * Update time_condition_edit.php * Update call_block.php * Update call_recordings.php * Update devices.php * Update email_queue.php * Update emergency.php * Update event_guard_logs.php * Update fax_files.php * Update fax_logs.php * Update fax_queue.php * Update recordings.php * Update xml_cdr_inc.php * Update user_logs.php * Update destination_summary.php * Update xml_cdr_extension_summary.php * Update music_on_hold.php * Update fax_send.php * Update voicemail_greetings.php * Update voicemail_greetings.php * Update xml_cdr_inc.php * Update xml_cdr_inc.php * Update xml_cdr_inc.php * Update xml_cdr_statistics_inc.php * Update xml_cdr_statistics_inc.php * Update xml_cdr_inc.php * Update xml_cdr_extension_summary.php * Update destination_summary.php * Update xml_cdr_statistics_inc.php * Update xml_cdr_inc.php * Update xml_cdr_statistics_inc.php * Update contact_edit.php * Update css.php * Update template.php * Update fax_send.php
This commit is contained in:
@@ -296,12 +296,13 @@
|
||||
|
||||
//set the time zone
|
||||
$time_zone = $settings->get('domain', 'time_zone', date_default_timezone_get());
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
|
||||
//set the sql time format
|
||||
$sql_time_format = 'HH12:MI am';
|
||||
if (!empty($settings->get('domain', 'time_format'))) {
|
||||
$sql_time_format = $settings->get('domain', 'time_format') == '12h' ? "HH12:MI am" : "HH24:MI";
|
||||
//set the time format options: 12h, 24h
|
||||
if ($settings->get('domain', 'time_format') == '24h') {
|
||||
$time_format = 'HH24:MI';
|
||||
}
|
||||
else {
|
||||
$time_format = 'HH12:MI am';
|
||||
}
|
||||
|
||||
//get the results from the db
|
||||
@@ -313,7 +314,7 @@
|
||||
$sql .= "c.start_stamp, \n";
|
||||
$sql .= "c.end_stamp, \n";
|
||||
$sql .= "to_char(timezone(:time_zone, start_stamp), 'DD Mon YYYY') as start_date_formatted, \n";
|
||||
$sql .= "to_char(timezone(:time_zone, start_stamp), '".$sql_time_format."') as start_time_formatted, \n";
|
||||
$sql .= "to_char(timezone(:time_zone, start_stamp), '".$time_format."') as start_time_formatted, \n";
|
||||
$sql .= "c.start_epoch, \n";
|
||||
$sql .= "c.hangup_cause, \n";
|
||||
$sql .= "c.billsec as duration, \n";
|
||||
@@ -471,50 +472,67 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($start_stamp_begin) && !empty($start_stamp_end)) {
|
||||
if (!empty($start_stamp_begin)) {
|
||||
$start_stamp_begin_formatted = ($settings->get('domain', 'time_format') == '24h' ? $start_stamp_begin : DateTime::createFromFormat('Y-m-d h:i a', $start_stamp_begin)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($start_stamp_end)) {
|
||||
$start_stamp_end_formatted = ($settings->get('domain', 'time_format') == '24h' ? $start_stamp_end : DateTime::createFromFormat('Y-m-d h:i a', $start_stamp_end)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($start_stamp_begin_formatted) && !empty($start_stamp_end_formatted)) {
|
||||
$sql .= "and start_stamp between :start_stamp_begin::timestamptz and :start_stamp_end::timestamptz \n";
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000 '.$time_zone;
|
||||
$parameters['start_stamp_end'] = $start_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin_formatted.':00.000 '.$time_zone;
|
||||
$parameters['start_stamp_end'] = $start_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
else {
|
||||
if (!empty($start_stamp_begin)) {
|
||||
if (!empty($start_stamp_begin_formatted)) {
|
||||
$sql .= "and start_stamp >= :start_stamp_begin \n";
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin.':00.000 '.$time_zone;
|
||||
$parameters['start_stamp_begin'] = $start_stamp_begin_formatted.':00.000 '.$time_zone;
|
||||
}
|
||||
if (!empty($start_stamp_end)) {
|
||||
if (!empty($start_stamp_end_formatted)) {
|
||||
$sql .= "and start_stamp <= :start_stamp_end \n";
|
||||
$parameters['start_stamp_end'] = $start_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['start_stamp_end'] = $start_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
}
|
||||
if (!empty($answer_stamp_begin) && !empty($answer_stamp_end)) {
|
||||
if (!empty($answer_stamp_begin)) {
|
||||
$answer_stamp_begin_formatted = ($settings->get('domain', 'time_format') == '24h' ? $answer_stamp_begin : DateTime::createFromFormat('Y-m-d h:i a', $answer_stamp_begin)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($answer_stamp_end)) {
|
||||
$answer_stamp_end_formatted = ($settings->get('domain', 'time_format') == '24h' ? $answer_stamp_end : DateTime::createFromFormat('Y-m-d h:i a', $answer_stamp_end)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($answer_stamp_begin_formatted) && !empty($answer_stamp_end_formatted)) {
|
||||
$sql .= "and answer_stamp between :answer_stamp_begin::timestamptz and :answer_stamp_end::timestamptz \n";
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000 '.$time_zone;
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin_formatted.':00.000 '.$time_zone;
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
else {
|
||||
if (!empty($answer_stamp_begin)) {
|
||||
if (!empty($answer_stamp_begin_formatted)) {
|
||||
$sql .= "and answer_stamp >= :answer_stamp_begin \n";
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin.':00.000 '.$time_zone;;
|
||||
$parameters['answer_stamp_begin'] = $answer_stamp_begin_formatted.':00.000 '.$time_zone;;
|
||||
}
|
||||
if (!empty($answer_stamp_end)) {
|
||||
if (!empty($answer_stamp_end_formatted)) {
|
||||
$sql .= "and answer_stamp <= :answer_stamp_end \n";
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['answer_stamp_end'] = $answer_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
}
|
||||
if (!empty($end_stamp_begin) && !empty($end_stamp_end)) {
|
||||
if (!empty($end_stamp_begin)) {
|
||||
$end_stamp_begin_formatted = ($settings->get('domain', 'time_format') == '24h' ? $end_stamp_begin : DateTime::createFromFormat('Y-m-d h:i a', $end_stamp_begin)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($end_stamp_end)) {
|
||||
$end_stamp_end_formatted = ($settings->get('domain', 'time_format') == '24h' ? $end_stamp_end : DateTime::createFromFormat('Y-m-d h:i a', $end_stamp_end)->format('Y-m-d H:i'));
|
||||
}
|
||||
if (!empty($end_stamp_begin_formatted) && !empty($end_stamp_end_formatted)) {
|
||||
$sql .= "and end_stamp between :end_stamp_begin::timestamptz and :end_stamp_end::timestamptz \n";
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000 '.$time_zone;
|
||||
$parameters['end_stamp_end'] = $end_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin_formatted.':00.000 '.$time_zone;
|
||||
$parameters['end_stamp_end'] = $end_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
else {
|
||||
if (!empty($end_stamp_begin)) {
|
||||
if (!empty($end_stamp_begin_formatted)) {
|
||||
$sql .= "and end_stamp >= :end_stamp_begin \n";
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin.':00.000 '.$time_zone;
|
||||
$parameters['end_stamp_begin'] = $end_stamp_begin_formatted.':00.000 '.$time_zone;
|
||||
}
|
||||
if (!empty($end_stamp_end)) {
|
||||
if (!empty($end_stamp_end_formatted)) {
|
||||
$sql .= "and end_stamp <= :end_stamp_end \n";
|
||||
$parameters['end_stamp'] = $end_stamp_end.':59.999 '.$time_zone;
|
||||
$parameters['end_stamp'] = $end_stamp_end_formatted.':59.999 '.$time_zone;
|
||||
}
|
||||
}
|
||||
if (is_numeric($duration_min)) {
|
||||
@@ -652,6 +670,7 @@
|
||||
$database->username = $settings->get('cdr', 'archive_database_username');
|
||||
$database->password = $settings->get('cdr', 'archive_database_password');
|
||||
}
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
$result_count = is_array($result) ? sizeof($result) : 0;
|
||||
unset($sql, $parameters);
|
||||
|
||||
Reference in New Issue
Block a user