Dashboard - Missed Calls: Apply domain time zone.

This commit is contained in:
fusionate 2023-08-01 20:33:51 +00:00
parent d68f9826f1
commit f61302190b
No known key found for this signature in database
1 changed files with 7 additions and 7 deletions

View File

@ -31,8 +31,7 @@
//get the missed calls from call detail records
$sql = "select \n";
$sql .= " direction, \n";
$sql .= " start_stamp, \n";
$sql .= " start_epoch, \n";
$sql .= " to_char(timezone(:time_zone, start_stamp), '".(!empty($_SESSION['domain']['time_format']) && $_SESSION['domain']['time_format']['text'] == '12h' ? "MM/DD HH12:MI am" : "MM/DD HH24:MI")."') as start_date_time, \n";
$sql .= " caller_id_name, \n";
$sql .= " caller_id_number, \n";
$sql .= " answer_stamp \n";
@ -63,6 +62,7 @@
$sql .= "and start_epoch > ".(time() - 86400)." \n";
$sql .= "order by \n";
$sql .= "start_epoch desc \n";
$parameters['time_zone'] = isset($_SESSION['domain']['time_zone']['name']) ? $_SESSION['domain']['time_zone']['name'] : date_default_timezone_get();
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
if (!isset($database)) { $database = new database; }
$result = $database->select($sql, $parameters, 'all');
@ -141,10 +141,10 @@
foreach ($result as $index => $row) {
if ($index + 1 > $missed_limit) { break; } //only show limit
$tmp_year = date("Y", strtotime($row['start_stamp']));
$tmp_month = date("M", strtotime($row['start_stamp']));
$tmp_day = date("d", strtotime($row['start_stamp']));
$tmp_start_epoch = !empty($_SESSION['domain']['time_format']) && $_SESSION['domain']['time_format']['text'] == '12h' ? date("n/j g:ia", $row['start_epoch']) : date("n/j H:i", $row['start_epoch']);
$start_date_time = str_replace('/0','/', ltrim($row['start_date_time'], '0'));
if (!empty($_SESSION['domain']['time_format']) && $_SESSION['domain']['time_format']['text'] == '12h') {
$start_date_time = str_replace(' 0',' ', $start_date_time);
}
//set click-to-call variables
if (permission_exists('click_to_call_call')) {
$tr_link = "onclick=\"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php".
@ -170,7 +170,7 @@
}
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' nowrap='nowrap'><a href='javascript:void(0);' ".(($row['caller_id_name'] != '') ? "title=\"".$row['caller_id_name']."\"" : null).">".((is_numeric($row['caller_id_number'])) ? format_phone($row['caller_id_number']) : $row['caller_id_number'])."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' nowrap='nowrap'>".$tmp_start_epoch."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' nowrap='nowrap'>".$start_date_time."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}