From e753ce9175ecb2fe43a8798a29ff7ef5c2ce398d Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 10 Feb 2024 14:36:52 -0700 Subject: [PATCH] Update emergency logs --- app/emergency/app_config.php | 97 ++++++------ app/emergency/app_languages.php | 252 ++++++++++++++++---------------- app/emergency/emergency.php | 31 ++-- 3 files changed, 187 insertions(+), 193 deletions(-) diff --git a/app/emergency/app_config.php b/app/emergency/app_config.php index 53f7f09e0a..3ede60ab78 100644 --- a/app/emergency/app_config.php +++ b/app/emergency/app_config.php @@ -19,78 +19,67 @@ $apps[$x]['description']['pt-pt'] = ''; $apps[$x]['description']['pt-br'] = ''; - //permission details - $y=0; - $apps[$x]['permissions'][$y]['name'] = "emergency_logs_view"; - $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; - $apps[$x]['permissions'][$y]['menu']['uuid'] = "23a6fc8a-77f1-11ee-88b0-005056a27559"; + //permission details + $y=0; + $apps[$x]['permissions'][$y]['name'] = "emergency_logs_view"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['menu']['uuid'] = "23a6fc8a-77f1-11ee-88b0-005056a27559"; $y++; - $apps[$x]['permissions'][$y]['name'] = "emergency_logs_view_all"; - $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['name'] = "emergency_logs_view_all"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $y++; //schema details $z=0; $apps[$x]['db'][$y]['table']['name'] = "v_emergency_logs"; $apps[$x]['db'][$y]['table']['parent'] = ""; - $apps[$x]['db'][$y]['fields'][$z]['name'] = 'log_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'emergency_log_uuid'; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary'; $apps[$x]['db'][$y]['fields'][$z]['description'] = ''; $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid'; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; - $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign'; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains'; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid'; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = 'date'; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text'; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['description'] = ''; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = 'time'; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text'; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['description'] = ''; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'extension'; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'numeric'; $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; $apps[$x]['db'][$y]['fields'][$z]['description'] = ''; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'event'; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description'] = ''; $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz'; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date'; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date'; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_user"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "update_date"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz'; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date'; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date'; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "update_user"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; -?> + $apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_user"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "update_date"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "update_user"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + +?> \ No newline at end of file diff --git a/app/emergency/app_languages.php b/app/emergency/app_languages.php index c909a940ce..c681e62eaa 100644 --- a/app/emergency/app_languages.php +++ b/app/emergency/app_languages.php @@ -1,133 +1,133 @@ +?> \ No newline at end of file diff --git a/app/emergency/emergency.php b/app/emergency/emergency.php index 3564d30f98..19f4da253c 100644 --- a/app/emergency/emergency.php +++ b/app/emergency/emergency.php @@ -78,9 +78,8 @@ if (!empty($_GET["show"])) { $show = $_GET["show"]; } - //get the count -$sql = "select count(log_uuid) "; +$sql = "select count(emergency_log_uuid) "; $sql .= "from v_emergency_logs "; if ($show == 'all') { $sql .= "where true "; @@ -117,7 +116,13 @@ else { } //get the list -$sql = "select * "; +$sql = "select emergency_log_uuid, "; +$sql .= "domain_uuid, "; +$sql .= "extension, "; +$sql .= "event, "; +$sql .= "to_char(timezone(:time_zone, insert_date), 'DD Mon YYYY') as date_formatted, "; +$sql .= "to_char(timezone(:time_zone, insert_date), 'HH12:MI:SS am') as time_formatted, "; +$sql .= "insert_date "; $sql .= "from v_emergency_logs "; if ($show == 'all') { $sql .= "where true "; @@ -133,7 +138,7 @@ if (!empty($search)) { $parameters['search'] = '%'.$search.'%'; } $sql .= limit_offset($rows_per_page, $offset); - +$parameters['time_zone'] = $time_zone; $database = new database; $emergency_logs = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); @@ -143,12 +148,12 @@ $object = new token; $token = $object->create($_SERVER['PHP_SELF']); //additional includes -$document['title'] = $text['title-emergency-logs']; +$document['title'] = $text['title-emergency_logs']; require_once "resources/header.php"; //show the content echo "
\n"; -echo "
".$text['title-emergency-logs']." (".$num_rows.")
\n"; +echo "
".$text['title-emergency_logs']." (".$num_rows.")
\n"; echo "
\n"; if ($emergency_logs) { echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display:none;','onclick'=>"modal_open('modal-delete','btn_delete');"]); @@ -181,18 +186,18 @@ echo "

\n"; echo "\n"; echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; -echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; echo "\n"; if (!empty($emergency_logs) && is_array($emergency_logs) && @sizeof($emergency_logs) != 0) { $x = 0; foreach ($emergency_logs as $row) { echo "\n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo "\n"; @@ -210,4 +215,4 @@ echo "\n"; //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file
".$text['lable-emergency-time']."".$text['lable-emergency-date']."".$text['lable-emergency-extension']."".$text['lable-emergency-event']."".$text['lable-emergency_time']."".$text['lable-emergency_date']."".$text['lable-emergency_extension']."".$text['lable-emergency_event']."
".escape($row['time'])."".escape($row['date'])."".escape($row['time_formatted'])."".escape($row['date_formatted'])."".escape($row['extension'])."".escape($row['event'])."