From cf1c460a9d5d00c277319f5e7fc960e7469837bd Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 11 Mar 2021 09:12:53 +0100 Subject: [PATCH] Fixed all issues --- .../include/class/ExternalTools.class.php | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/class/ExternalTools.class.php b/pandora_console/include/class/ExternalTools.class.php index 23232aed10..403cd72fa6 100644 --- a/pandora_console/include/class/ExternalTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -149,19 +149,35 @@ class ExternalTools extends HTML $external_tools_config['dig_path'] = $this->pathDig; $external_tools_config['snmpget_path'] = $this->pathSnmpget; + $otherParameters = []; + $otherParameters['sound_alert'] = (string) get_parameter('sound_alert'); + $otherParameters['sound_critical'] = (string) get_parameter('sound_critical'); + $otherParameters['sound_warning'] = (string) get_parameter('sound_warning'); + $otherParameters['graphviz_bin_dir'] = (string) get_parameter('graphviz_bin_dir'); + if (empty($this->pathCustomComm) === false) { $external_tools_config['custom_commands'] = $this->pathCustomComm; } - $result = config_update_value( - 'external_tools_config', - json_encode($external_tools_config) - ); + foreach ($otherParameters as $keyParam => $valueParam) { + $result = config_update_value($keyParam, $valueParam); + + if ($result === false) { + break; + } + } + + if ($result === true) { + $result = config_update_value( + 'external_tools_config', + json_encode($external_tools_config) + ); + } ui_print_result_message( - $result, - __('Set the paths.'), - __('Set the paths.') + ($result), + __('Changes successfully saved.'), + __('Changes not saved.') ); } else { if (isset($config['external_tools_config']) === true) {