From e0f430907672c710afc55e958d04de14f91ed33c Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 12 Mar 2024 17:44:46 -0600 Subject: [PATCH] New setting call_log_enabled default false --- app/xml_cdr/app_config.php | 8 ++++++ app/xml_cdr/resources/classes/xml_cdr.php | 7 +---- app/xml_cdr/xml_cdr_details.php | 34 ++++++++++++----------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/app/xml_cdr/app_config.php b/app/xml_cdr/app_config.php index 9b91f40452..58b5e1bf7e 100644 --- a/app/xml_cdr/app_config.php +++ b/app/xml_cdr/app_config.php @@ -386,6 +386,14 @@ $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Options: horizontal, vertical"; $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "29d1b0c5-bad7-492f-9517-409ad4912f6f"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "cdr"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "call_log_enabled"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Enable or disable adding call logs to the database."; + $y++; $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "9d6ba316-a954-476b-9d8c-4520c3c69d2c"; $apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard"; $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "missed_calls_chart_main_background_color"; diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 6e5534ac29..bdd7e78099 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -963,7 +963,7 @@ if (!class_exists('xml_cdr')) { } //save the call log to the database - if (!empty($this->setting->get('switch', 'log')) && $this->setting->get('cdr', 'storage') == "db") { + if ($this->setting->get('cdr', 'call_log_enabled') == 'true' && !empty($this->setting->get('switch', 'log')) && $this->setting->get('cdr', 'storage') == "db") { //get the log content $log_content = ''; $handle = @fopen($this->setting->get('switch', 'log').'/freeswitch.log', "r"); @@ -2034,8 +2034,3 @@ if (!class_exists('xml_cdr')) { } ?> - - - - - diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php index 781a5e2c1d..7e7274c5cc 100644 --- a/app/xml_cdr/xml_cdr_details.php +++ b/app/xml_cdr/xml_cdr_details.php @@ -117,22 +117,24 @@ } //get the cdr log from the database - $sql = "select * from v_xml_cdr_logs "; - if (permission_exists('xml_cdr_all')) { - $sql .= "where xml_cdr_uuid = :xml_cdr_uuid "; + if ($_SESSION['cdr']['call_log_enabled']['boolean'] == 'true') { + $sql = "select * from v_xml_cdr_logs "; + if (permission_exists('xml_cdr_all')) { + $sql .= "where xml_cdr_uuid = :xml_cdr_uuid "; + } + else { + $sql .= "where xml_cdr_uuid = :xml_cdr_uuid "; + $sql .= "and domain_uuid = :domain_uuid "; + $parameters['domain_uuid'] = $domain_uuid; + } + $parameters['xml_cdr_uuid'] = $uuid; + $database = new database; + $row = $database->select($sql, $parameters, 'row'); + if (!empty($row) && is_array($row) && @sizeof($row) != 0) { + $log_content = $row["log_content"]; + } + unset($sql, $parameters, $row); } - else { - $sql .= "where xml_cdr_uuid = :xml_cdr_uuid "; - $sql .= "and domain_uuid = :domain_uuid "; - $parameters['domain_uuid'] = $domain_uuid; - } - $parameters['xml_cdr_uuid'] = $uuid; - $database = new database; - $row = $database->select($sql, $parameters, 'row'); - if (!empty($row) && is_array($row) && @sizeof($row) != 0) { - $log_content = $row["log_content"]; - } - unset($sql, $parameters, $row); //get the format if (!empty($xml_string)) { @@ -321,7 +323,7 @@ echo "".$text['title2']."\n"; echo "\n"; echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-left: 15px;','link'=>'xml_cdr.php'.(!empty($_SESSION['xml_cdr']['last_query']) ? '?'.urlencode($_SESSION['xml_cdr']['last_query']) : null)]); - if (isset($log_content) && !empty($log_content)) { + if ($_SESSION['cdr']['call_log_enabled']['boolean'] == 'true' && isset($log_content) && !empty($log_content)) { echo button::create(['type'=>'button','label'=>$text['button-call_log'],'icon'=>$_SESSION['theme']['button_icon_search'],'style'=>'margin-left: 15px;','link'=>'xml_cdr_log.php?id='.$uuid]); } echo "\n";