diff --git a/pandora_console/extras/mr/60.sql b/pandora_console/extras/mr/60.sql
new file mode 100644
index 0000000000..8d662a5fb7
--- /dev/null
+++ b/pandora_console/extras/mr/60.sql
@@ -0,0 +1,6 @@
+START TRANSACTION;
+
+ALTER TABLE treport_content ADD COLUMN use_prefix_notation tinyint(1) default '1';
+ALTER TABLE treport_content_template ADD COLUMN use_prefix_notation tinyint(1) default '1';
+
+COMMIT;
diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index 3cc78b737c..51653d0ce0 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -168,6 +168,7 @@ $visual_format = 0;
$filter_search = '';
$filter_exclude = '';
+$use_prefix_notation = true;
// Added for select fields.
$total_time = true;
@@ -460,6 +461,7 @@ switch ($action) {
$lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format'];
+ $use_prefix_notation = $item['use_prefix_notation'];
break;
case 'max_value':
@@ -475,6 +477,7 @@ switch ($action) {
$lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format'];
+ $use_prefix_notation = $item['use_prefix_notation'];
break;
case 'min_value':
@@ -490,6 +493,7 @@ switch ($action) {
$lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format'];
+ $use_prefix_notation = $item['use_prefix_notation'];
break;
case 'sumatory':
@@ -503,6 +507,7 @@ switch ($action) {
$idAgentModule = $item['id_agent_module'];
$period = $item['period'];
$uncompressed_module = $item['uncompressed_module'];
+ $use_prefix_notation = $item['use_prefix_notation'];
break;
case 'historical_data':
@@ -771,6 +776,7 @@ switch ($action) {
$show_resume = $item['show_resume'];
$show_graph = $item['show_graph'];
$order_uptodown = $item['order_uptodown'];
+ $use_prefix_notation = $item['use_prefix_notation'];
$text_agent = '';
if (isset($style['text_agent']) === true
@@ -3407,6 +3413,22 @@ $class = 'databox filters';
+
data[$row][1] = ''.__('Example').' '.date($config['date_f
$table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true);
$row++;
+$decimal_separators = [
+ ',' => ',',
+ '.' => '.'
+];
+
+$table_other->data[$row][0] = __('Decimal separator');
+$table_other->data[$row][1] = html_print_select(
+ $decimal_separators,
+ 'decimal_separator',
+ $config['decimal_separator'],
+ '',
+ '',
+ '',
+ true,
+ false,
+ false
+);
+
+
+$row++;
+
if ($config['prominent_time'] == 'comparation') {
$timestamp = false;
$comparation = true;
diff --git a/pandora_console/include/ajax/custom_fields.php b/pandora_console/include/ajax/custom_fields.php
index 3fd81ec4b0..77e79800aa 100644
--- a/pandora_console/include/ajax/custom_fields.php
+++ b/pandora_console/include/ajax/custom_fields.php
@@ -429,7 +429,9 @@ if (check_login()) {
$table_modules->data[$key][1] = remove_right_zeros(
number_format(
$value['datos'],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
);
} else {
diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php
index c43da3e146..8efb03df12 100755
--- a/pandora_console/include/ajax/module.php
+++ b/pandora_console/include/ajax/module.php
@@ -499,7 +499,9 @@ if (check_login()) {
$data[] = remove_right_zeros(
number_format(
$row[$attr[0]],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
);
}
@@ -507,7 +509,9 @@ if (check_login()) {
$data[] = remove_right_zeros(
number_format(
$row[$attr[0]],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
);
}
@@ -524,7 +528,9 @@ if (check_login()) {
$data[] = remove_right_zeros(
number_format(
$row[$attr[0]],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
);
}
diff --git a/pandora_console/include/class/AgentWizard.class.php b/pandora_console/include/class/AgentWizard.class.php
index dc6bd5df5f..2602b9a0c2 100644
--- a/pandora_console/include/class/AgentWizard.class.php
+++ b/pandora_console/include/class/AgentWizard.class.php
@@ -2546,6 +2546,8 @@ class AgentWizard extends HTML
*/
private function resultsInterfaceWizard()
{
+ global $config;
+
$generalInterfaceModules = $this->getInterfacesModules();
$generalInterfaceTables = [];
$generalInterfaceModulesUpdated = [];
@@ -2759,7 +2761,12 @@ class AgentWizard extends HTML
// Format current value with thousands and decimals.
if (is_numeric($currentValue) === true) {
$decimals = (is_float($currentValue) === true) ? 2 : 0;
- $currentValue = number_format($currentValue, $decimals);
+ $currentValue = number_format(
+ $currentValue,
+ $decimals,
+ $config['decimal_separator'],
+ $config['thousand_separator']
+ );
}
// It unit of measure have data, attach to current value.
diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php
index b8ca6e3690..5215a09aa3 100644
--- a/pandora_console/include/class/Diagnostics.class.php
+++ b/pandora_console/include/class/Diagnostics.class.php
@@ -986,7 +986,7 @@ class Diagnostics extends Wizard
],
'tablesFragmentationValue' => [
'name' => __('Tables fragmentation (current value)'),
- 'value' => number_format($tFragmentationValue, 2).'%',
+ 'value' => number_format($tFragmentationValue, 2, $config['decimal_separator'], $config['thousand_separator']).'%',
],
'tablesFragmentationStatus' => [
'name' => __('Table fragmentation status'),
@@ -1121,7 +1121,9 @@ class Diagnostics extends Wizard
if ($totalModuleIntervalTime !== false) {
$averageTime = number_format(
((int) $totalNetworkModules / (int) $totalModuleIntervalTime),
- 3
+ 3,
+ $config['decimal_separator'],
+ $config['thousand_separator']
);
}
@@ -1748,7 +1750,7 @@ class Diagnostics extends Wizard
$sizeServerLog = number_format($fileSize);
$sizeServerLog = (0 + str_replace(',', '', $sizeServerLog));
- $value = number_format(($fileSize / $mega), 3);
+ $value = number_format(($fileSize / $mega), 3, $config['decimal_separator'], $config['thousand_separator']);
$message = __('You have more than 10 MB of logs');
$status = 0;
if ($sizeServerLog <= $tenMega) {
diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php
index ed999553cb..f2363edc71 100644
--- a/pandora_console/include/functions.php
+++ b/pandora_console/include/functions.php
@@ -219,6 +219,8 @@ function list_files($directory, $stringSearch, $searchHandler, $return=false)
*/
function format_numeric($number, $decimals=1)
{
+ global $config;
+
// Translate to float in case there are characters in the string so
// fmod doesn't throw a notice
$number = (float) $number;
@@ -227,17 +229,11 @@ function format_numeric($number, $decimals=1)
return 0;
}
- // Translators: This is separator of decimal point
- $dec_point = __('.');
- // Translators: This is separator of decimal point
- $thousands_sep = __(',');
-
- // If has decimals
if (fmod($number, 1) > 0) {
- return number_format($number, $decimals, $dec_point, $thousands_sep);
+ return number_format($number, $decimals, $config['decimal_separator'], $config['thousand_separator']);
}
- return number_format($number, 0, $dec_point, $thousands_sep);
+ return number_format($number, 0, $config['decimal_separator'], $config['thousand_separator']);
}
@@ -4084,14 +4080,18 @@ function series_type_graph_array($data, $show_elements_graph)
$data_return['legend'][$key] .= remove_right_zeros(
number_format(
$value['min'],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
);
$data_return['legend'][$key] .= ' '.__('Max:');
$data_return['legend'][$key] .= remove_right_zeros(
number_format(
$value['max'],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
);
$data_return['legend'][$key] .= ' '._('Avg:');
@@ -4099,7 +4099,8 @@ function series_type_graph_array($data, $show_elements_graph)
number_format(
$value['avg'],
$config['graph_precision'],
- $config['csv_decimal_separator']
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
).' '.$str;
}
@@ -4156,7 +4157,9 @@ function series_type_graph_array($data, $show_elements_graph)
$data_return['legend'][$key] .= remove_right_zeros(
number_format(
$value['data'][0][1],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
).' '.$str;
}
diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index 958261274a..8d9e4b0b50 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -1467,6 +1467,15 @@ function config_update_config()
if (config_update_value('use_data_multiplier', get_parameter('use_data_multiplier', '1'), true) === false) {
$error_update[] = __('Use data multiplier');
}
+
+ if (config_update_value('decimal_separator', (string) get_parameter('decimal_separator', '.'), true) === false) {
+ $error_update[] = __('Decimal separator');
+ } else {
+ $thousand_separator = ((string) get_parameter('decimal_separator', '.') === '.') ? ',' : '.';
+ if (config_update_value('thousand_separator', $thousand_separator, true) === false) {
+ $error_update[] = __('Thousand separator');
+ }
+ }
break;
case 'net':
@@ -3422,6 +3431,10 @@ function config_process_config()
config_update_value('module_library_password', '');
}
+ if (!isset($config['decimal_separator'])) {
+ config_update_value('decimal_separator', '.');
+ }
+
// Finally, check if any value was overwritten in a form.
config_update_config();
}
diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index ef41904c38..a777f4389c 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -1950,7 +1950,7 @@ function html_print_extended_select_for_post_process(
$found = false;
if ($selected) {
- if (array_key_exists(number_format($selected, 14, '.', ','), $fields)) {
+ if (array_key_exists(number_format($selected, 14, $config['decimal_separator'], $config['thousand_separator']), $fields)) {
$found = true;
}
}
diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php
index 443e482173..59ead9b943 100755
--- a/pandora_console/include/functions_modules.php
+++ b/pandora_console/include/functions_modules.php
@@ -2589,12 +2589,12 @@ function modules_get_agentmodule_data_for_humans($module)
$salida = human_milliseconds_to_string($module['datos']);
}
} else {
- $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
+ $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
}
break;
default:
- $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
+ $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
break;
}
break;
@@ -2613,12 +2613,12 @@ function modules_get_agentmodule_data_for_humans($module)
$salida = human_milliseconds_to_string($module['datos']);
}
} else {
- $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
+ $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
}
break;
default:
- $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
+ $salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
break;
}
}
@@ -2900,7 +2900,7 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
}
if (is_numeric($data)) {
- $title .= ': '.remove_right_zeros(number_format($data, $config['graph_precision']));
+ $title .= ': '.remove_right_zeros(number_format($data, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
} else {
$text = io_safe_output($data);
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index ab1e64cfcf..cbd6e276a9 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -1833,14 +1833,24 @@ function reporting_event_top_n(
$divisor = get_data_multiplier($units[$key_dt]);
- $data['formated_value'] = format_for_graph(
- $dt,
- 2,
- '.',
- ',',
- $divisor,
- $units[$key_dt]
- );
+ if ((bool) $content['use_prefix_notation'] === false) {
+ $data['formated_value'] = number_format(
+ $dt,
+ 2,
+ $config['decimal_separator'],
+ $config['thousand_separator']
+ ).' '.$units[$key_dt];
+ } else {
+ $data['formated_value'] = format_for_graph(
+ $dt,
+ 2,
+ '.',
+ ',',
+ $divisor,
+ $units[$key_dt]
+ );
+ }
+
$data_return[] = $data;
}
@@ -1901,14 +1911,25 @@ function reporting_event_top_n(
$data['agent'] = $an;
$data['module'] = $module_name[$key_an];
$data['value'] = $data_top[$key_an];
- $data['formated_value'] = format_for_graph(
- $data_top[$key_an],
- 2,
- '.',
- ',',
- $divisor,
- $units[$key_an]
- );
+
+ if ((bool) $content['use_prefix_notation'] === false) {
+ $data['formated_value'] = number_format(
+ $data_top[$key_an],
+ 2,
+ $config['decimal_separator'],
+ $config['thousand_separator']
+ ).' '.$units[$key_an];
+ } else {
+ $data['formated_value'] = format_for_graph(
+ $data_top[$key_an],
+ 2,
+ '.',
+ ',',
+ $divisor,
+ $units[$key_an]
+ );
+ }
+
$data_return[] = $data;
}
@@ -6925,6 +6946,13 @@ function reporting_value($report, $content, $type, $pdf=false)
if (!$config['simple_module_value']) {
$formated_value = $value;
+ } else if ((bool) $content['use_prefix_notation'] === false) {
+ $formated_value = number_format(
+ $value,
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
+ ).' '.$unit;
} else {
$formated_value = format_for_graph(
$value,
@@ -7085,6 +7113,13 @@ function reporting_value($report, $content, $type, $pdf=false)
);
if (!$config['simple_module_value']) {
$formated_value = $value;
+ } else if ((bool) $content['use_prefix_notation'] === false) {
+ $formated_value = number_format(
+ $value,
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
+ ).' '.$unit;
} else {
$divisor = get_data_multiplier($unit);
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index 029b0d70b6..27b7037751 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -2283,7 +2283,9 @@ function reporting_html_agent_module_status($table, $item, $pdf=0)
$row['data_module'] = remove_right_zeros(
number_format(
$data['data_module'],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
);
} else {
@@ -2776,7 +2778,7 @@ function reporting_html_historical_data($table, $item, $pdf=0)
} else {
$row = [
$data[__('Date')],
- remove_right_zeros(number_format($data[__('Data')], $config['graph_precision'])),
+ remove_right_zeros(number_format($data[__('Data')], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])),
];
}
@@ -2916,7 +2918,9 @@ function reporting_html_last_value($table, $item, $pdf=0)
$dataDatos = remove_right_zeros(
number_format(
$item['data']['datos'],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
);
} else {
@@ -3461,7 +3465,9 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
).' '.__('OK').': '.remove_right_zeros(
number_format(
$item['data']['ok']['value'],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
).' %';
@@ -3472,7 +3478,9 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
).' '.__('Not OK').': '.remove_right_zeros(
number_format(
$item['data']['fail']['value'],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
).' % '.'';
}
@@ -3826,7 +3834,9 @@ function reporting_html_value(
remove_right_zeros(
number_format(
$data[__('Maximun')],
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
),
];
diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php
index 3fc35f4d84..e230ba54ca 100755
--- a/pandora_console/include/functions_treeview.php
+++ b/pandora_console/include/functions_treeview.php
@@ -193,7 +193,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
$data = "".human_milliseconds_to_string($last_data['datos']).'';
} else if (is_numeric($last_data['datos'])) {
- $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'';
+ $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
@@ -209,7 +209,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
default:
if (is_numeric($last_data['datos'])) {
- $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'';
+ $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
@@ -232,7 +232,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
$data = "".human_milliseconds_to_string($last_data['datos']).'';
} else if (is_numeric($last_data['datos'])) {
- $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'';
+ $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
@@ -248,7 +248,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
default:
if (is_numeric($last_data['datos'])) {
- $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'';
+ $data = "".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'';
} else {
$data = ui_print_truncate_text(
io_safe_output($last_data['datos']),
@@ -271,7 +271,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
$data_macro = modules_get_unit_macro($last_data['datos'], $module['unit']);
if ($data_macro) {
if (is_numeric($data_macro)) {
- $last_data_str = "".remove_right_zeros(number_format($data_macro, $config['graph_precision'])).'';
+ $last_data_str = "".remove_right_zeros(number_format($data_macro, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'';
} else {
$last_data_str = ui_print_truncate_text(
io_safe_output($data_macro),
diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php
index 1e9d9f8dd7..dfc5b5e4ea 100755
--- a/pandora_console/include/functions_ui.php
+++ b/pandora_console/include/functions_ui.php
@@ -6558,10 +6558,10 @@ function ui_print_comments($comments)
} else {
$rest_time = (time() - $last_comment[0][0]['utimestamp']);
$time_last = (($rest_time / 60) / 60);
- $comentario = ''.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
+ $comentario = ''.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).' Hours ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
if (strlen($comentario) > '200px') {
- $comentario = ''.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
+ $comentario = ''.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).' Hours ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
}
}
diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php
index fce3aabe2d..97b14e4275 100755
--- a/pandora_console/include/functions_visual_map.php
+++ b/pandora_console/include/functions_visual_map.php
@@ -924,7 +924,7 @@ function visual_map_print_item(
$value_text = format_for_graph($module_value, 2);
if ($value_text <= 0) {
- $value_text = remove_right_zeros(number_format($module_value, $config['graph_precision']));
+ $value_text = remove_right_zeros(number_format($module_value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
}
if (!empty($unit_text)) {
@@ -1743,7 +1743,7 @@ function visual_map_print_item(
|| (modules_is_boolean($layoutData['id_agente_modulo']) && $layoutData['show_last_value'] != 0)
) {
if (is_numeric($value)) {
- $img_style_title .= ' '.__('Last value: ').remove_right_zeros(number_format($value, $config['graph_precision']));
+ $img_style_title .= ' '.__('Last value: ').remove_right_zeros(number_format($value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
} else {
$img_style_title .= ' '.__('Last value: ').$value;
}
@@ -1881,13 +1881,13 @@ function visual_map_print_item(
echo ' |
';
echo "';
$output .= remove_right_zeros(
- number_format($data_module, $config['graph_precision'])
+ number_format($data_module, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])
);
$output .= '
';
diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_value.php b/pandora_console/include/lib/Dashboard/Widgets/module_value.php
index 41fdd41663..6577ad3c89 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/module_value.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/module_value.php
@@ -439,7 +439,9 @@ class ModuleValueWidget extends Widget
$dataDatos = remove_right_zeros(
number_format(
$data_module,
- $config['graph_precision']
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
)
);
} else {
diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php
index 27b400db97..50fca70543 100644
--- a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php
+++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php
@@ -397,10 +397,12 @@ final class Group extends Item
string $groupName,
array $agentStats
): string {
- $critical = \number_format($agentStats['critical'], 2).'%';
- $warning = \number_format($agentStats['warning'], 2).'%';
- $normal = \number_format($agentStats['normal'], 2).'%';
- $unknown = \number_format($agentStats['unknown'], 2).'%';
+ global $config;
+
+ $critical = \number_format($agentStats['critical'], 2, $config['decimal_separator'], $config['thousand_separator']).'%';
+ $warning = \number_format($agentStats['warning'], 2, $config['decimal_separator'], $config['thousand_separator']).'%';
+ $normal = \number_format($agentStats['normal'], 2, $config['decimal_separator'], $config['thousand_separator']).'%';
+ $unknown = \number_format($agentStats['unknown'], 2, $config['decimal_separator'], $config['thousand_separator']).'%';
$html = '';
$html .= '
';
diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Percentile.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Percentile.php
index 19e14f3456..657f73364d 100644
--- a/pandora_console/include/rest-api/models/VisualConsole/Items/Percentile.php
+++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Percentile.php
@@ -396,8 +396,8 @@ final class Percentile extends Item
$data['value'] = (float) \number_format(
(float) $moduleValue,
(int) $config['graph_precision'],
- '.',
- ''
+ $config['decimal_separator'],
+ $config['thousand_separator']
);
$unit = '';
if ($moduleId !== null && $moduleId !== 0) {
diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php b/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php
index adeaa9c29e..4eb1ba3abc 100644
--- a/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php
+++ b/pandora_console/include/rest-api/models/VisualConsole/Items/StaticGraph.php
@@ -281,7 +281,7 @@ final class StaticGraph extends Item
) {
if (\is_numeric($value)) {
$imgTitle .= __('Last value: ').\remove_right_zeros(
- \number_format((float) $value, (int) $config['graph_precision'])
+ \number_format((float) $value, (int) $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])
);
} else {
$imgTitle .= __('Last value: ').$value;
diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php
index ac888a13fa..6d118d6e10 100644
--- a/pandora_console/operation/agentes/pandora_networkmap.view.php
+++ b/pandora_console/operation/agentes/pandora_networkmap.view.php
@@ -2048,7 +2048,12 @@ if (is_ajax() === true) {
$array_filter = json_decode($networkmap['filter']);
if (isset($array_filter->z_dash)) {
- $array_filter->z_dash = number_format($scale, 2);
+ $array_filter->z_dash = number_format(
+ $scale,
+ 2,
+ $config['decimal_separator'],
+ $config['thousand_separator']
+ );
}
$filter = json_encode($array_filter);
diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php
index 320282e403..b0c7c3eba1 100644
--- a/pandora_console/operation/agentes/status_monitor.php
+++ b/pandora_console/operation/agentes/status_monitor.php
@@ -1589,7 +1589,7 @@ if (!empty($result)) {
if (is_numeric($row['datos'])) {
$data[6] = ui_print_status_image(
STATUS_MODULE_OK,
- __('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])),
+ __('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])),
true
);
} else {
@@ -1604,7 +1604,12 @@ if (!empty($result)) {
$data[6] = ui_print_status_image(
STATUS_MODULE_CRITICAL,
__('CRITICAL').': '.remove_right_zeros(
- number_format($row['datos'], $config['graph_precision'])
+ number_format(
+ $row['datos'],
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
+ )
),
true
);
@@ -1620,7 +1625,12 @@ if (!empty($result)) {
$data[6] = ui_print_status_image(
STATUS_MODULE_WARNING,
__('WARNING').': '.remove_right_zeros(
- number_format($row['datos'], $config['graph_precision'])
+ number_format(
+ $row['datos'],
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
+ )
),
true
);
@@ -1636,7 +1646,12 @@ if (!empty($result)) {
$data[6] = ui_print_status_image(
STATUS_MODULE_UNKNOWN,
__('UNKNOWN').': '.remove_right_zeros(
- number_format($row['datos'], $config['graph_precision'])
+ number_format(
+ $row['datos'],
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
+ )
),
true
);
@@ -1652,7 +1667,12 @@ if (!empty($result)) {
$data[6] = ui_print_status_image(
STATUS_MODULE_NO_DATA,
__('NO DATA').': '.remove_right_zeros(
- number_format($row['datos'], $config['graph_precision'])
+ number_format(
+ $row['datos'],
+ $config['graph_precision'],
+ $config['decimal_separator'],
+ $config['thousand_separator']
+ )
),
true
);
@@ -1672,7 +1692,7 @@ if (!empty($result)) {
if (is_numeric($row['datos'])) {
$data[6] = ui_print_status_image(
STATUS_MODULE_UNKNOWN,
- __('UNKNOWN').' - '.__('Last status').' '.__('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])),
+ __('UNKNOWN').' - '.__('Last status').' '.__('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])),
true
);
} else {
@@ -1688,7 +1708,7 @@ if (!empty($result)) {
if (is_numeric($row['datos'])) {
$data[6] = ui_print_status_image(
STATUS_MODULE_UNKNOWN,
- __('UNKNOWN').' - '.__('Last status').' '.__('CRITICAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])),
+ __('UNKNOWN').' - '.__('Last status').' '.__('CRITICAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])),
true
);
} else {
@@ -1704,7 +1724,7 @@ if (!empty($result)) {
if (is_numeric($row['datos'])) {
$data[6] = ui_print_status_image(
STATUS_MODULE_UNKNOWN,
- __('UNKNOWN').' - '.__('Last status').' '.__('WARNING').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])),
+ __('UNKNOWN').' - '.__('Last status').' '.__('WARNING').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])),
true
);
} else {
@@ -1849,12 +1869,12 @@ if (!empty($result)) {
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
$salida = human_milliseconds_to_string($row['datos']);
} else {
- $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision']));
+ $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
}
break;
default:
- $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision']));
+ $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
break;
}
break;
@@ -1866,12 +1886,12 @@ if (!empty($result)) {
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
$salida = human_milliseconds_to_string($row['datos']);
} else {
- $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision']));
+ $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
}
break;
default:
- $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision']));
+ $salida = remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
break;
}
}
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 880f77063f..304010ca75 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -1617,6 +1617,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`ipam_ip_not_assigned_to_agent` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`macros_definition` TEXT,
`render_definition` TEXT,
+ `use_prefix_notation` TINYINT UNSIGNED NOT NULL DEFAULT 1,
PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE
@@ -3244,6 +3245,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`ipam_ip_not_assigned_to_agent` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`macros_definition` TEXT,
`render_definition` TEXT,
+ `use_prefix_notation` TINYINT UNSIGNED NOT NULL DEFAULT 1,
PRIMARY KEY(`id_rc`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
diff --git a/pandora_plugins/intel_dcm/extensions/intel_dcm_agent_view.php b/pandora_plugins/intel_dcm/extensions/intel_dcm_agent_view.php
index bdc1186044..737aa70770 100644
--- a/pandora_plugins/intel_dcm/extensions/intel_dcm_agent_view.php
+++ b/pandora_plugins/intel_dcm/extensions/intel_dcm_agent_view.php
@@ -142,26 +142,26 @@ function main_intel_dcm_agent_view()
$sql = "SELECT description FROM tagent_custom_data WHERE id_field = $id_field_derated_power AND id_agent = $id_agent";
$derated_power = db_get_value_sql($sql);
- $percent = number_format((($avg_power / $derated_power) * 100), 2);
+ $percent = number_format((($avg_power / $derated_power) * 100), 2, $config['decimal_separator'], $config['thousand_separator']);
$data[0] = ''.__('Power utilization')." $percent%";
$data[0] .= progress_bar($percent, 400, 30, '', 2);
$data[0] .= '
';
$data[0] .= ''.__('Current stats').'';
$data[0] .= '
';
- $data[0] .= __('Power demand').': '.number_format($avg_power, 2).' Wh';
+ $data[0] .= __('Power demand').': '.number_format($avg_power, 2, $config['decimal_separator'], $config['thousand_separator']).' Wh';
$data[0] .= '
';
- $data[0] .= __('Inlet temp').': '.number_format($avg_temp, 2).' ºC';
+ $data[0] .= __('Inlet temp').': '.number_format($avg_temp, 2, $config['decimal_separator'], $config['thousand_separator']).' ºC';
$data[0] .= '
';
$data[0] .= ''.__('Last week summary').'';
$data[0] .= '
';
- $data[0] .= __('Equipment energy consumed').': '.number_format($mnged_energy, 2).' Wh';
+ $data[0] .= __('Equipment energy consumed').': '.number_format($mnged_energy, 2, $config['decimal_separator'], $config['thousand_separator']).' Wh';
$data[0] .= '
';
- $data[0] .= __('Equipment energy bill').': '.number_format($mnged_energy_bill, 2).' €';
+ $data[0] .= __('Equipment energy bill').': '.number_format($mnged_energy_bill, 2, $config['decimal_separator'], $config['thousand_separator']).' €';
$data[0] .= '
';
- $data[0] .= __('Calculated cooling energy').': '.number_format($cooling_energy, 2).' Wh';
+ $data[0] .= __('Calculated cooling energy').': '.number_format($cooling_energy, 2, $config['decimal_separator'], $config['thousand_separator']).' Wh';
$data[0] .= '
';
- $data[0] .= __('Calculated cooling energy bill').': '.number_format($cooling_energy_bill, 2).' €';
+ $data[0] .= __('Calculated cooling energy bill').': '.number_format($cooling_energy_bill, 2, $config['decimal_separator'], $config['thousand_separator']).' €';
// Print avg. power graph
$start_date = date('Y-m-d');