Fixed the registration count

- Fixed on the dashboard for those with superadmin group
- Fixed the count in the SIP status page
This commit is contained in:
FusionPBX 2024-09-21 12:39:10 -06:00 committed by GitHub
parent 91b845dc71
commit 52a320ec54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 5 deletions

View File

@ -80,13 +80,13 @@ if (!class_exists('registrations')) {
$xml_response = trim(event_socket::command($cmd)); $xml_response = trim(event_socket::command($cmd));
//show an error message //show an error message
if ($xml_response == "Invalid Profile!") { if ($xml_response == "Invalid Profile!") {
//add multi-lingual support //add multi-lingual support
$language = new text; $language = new text;
$text = $language->get(null, '/app/registrations'); $text = $language->get(null, '/app/registrations');
//show the error message //show the error message
$xml_response = "<error_msg>".escape($text['label-message'])."</error_msg>"; $xml_response = "<error_msg>".escape($text['label-message'])."</error_msg>";
} }
//santize the XML //santize the XML
@ -370,3 +370,4 @@ if (!class_exists('registrations')) {
} }
?> ?>

View File

@ -32,6 +32,9 @@
//registration count //registration count
if ($esl->is_connected() && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/registrations/")) { if ($esl->is_connected() && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/registrations/")) {
$registration = new registrations; $registration = new registrations;
if (permission_exists("registration_all")) {
$active_registrations = $registration->show = 'all';
}
$active_registrations = $registration->count(); $active_registrations = $registration->count();
} }

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2023 Portions created by the Initial Developer are Copyright (C) 2008-2024
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -42,6 +42,9 @@
$language = new text; $language = new text;
$text = $language->get(); $text = $language->get();
//create the database object
$database = database::new();
//create event socket //create event socket
$esl = event_socket::create(); $esl = event_socket::create();
if (!$esl->is_connected()) { if (!$esl->is_connected()) {
@ -52,7 +55,6 @@
$sql = "select g.domain_uuid, g.gateway, g.gateway_uuid, d.domain_name "; $sql = "select g.domain_uuid, g.gateway, g.gateway_uuid, d.domain_name ";
$sql .= "from v_gateways as g left "; $sql .= "from v_gateways as g left ";
$sql .= "outer join v_domains as d on d.domain_uuid = g.domain_uuid"; $sql .= "outer join v_domains as d on d.domain_uuid = g.domain_uuid";
$database = new database;
$gateways = $database->select($sql, null, 'all'); $gateways = $database->select($sql, null, 'all');
unset($sql); unset($sql);
@ -69,7 +71,6 @@
$parameters['sip_profile_hostname'] = $hostname; $parameters['sip_profile_hostname'] = $hostname;
} }
$sql .= "order by sip_profile_name asc "; $sql .= "order by sip_profile_name asc ";
$database = new database;
$rows = $database->select($sql, $parameters ?? null, 'all'); $rows = $database->select($sql, $parameters ?? null, 'all');
if (!empty($rows)) { if (!empty($rows)) {
foreach ($rows as $row) { foreach ($rows as $row) {
@ -104,6 +105,7 @@
//define registration object //define registration object
$registration = new registrations; $registration = new registrations;
$registration->show = 'all';
//include the header //include the header
$document['title'] = $text['title-sip_status']; $document['title'] = $text['title-sip_status'];