Merge branch 'ent-9323-14021-Modificar-el-display-de-valores-de-informe' into 'develop'

implemented float formatting and option in reports to change visualization format

See merge request artica/pandorafms!5219
This commit is contained in:
Diego Muñoz-Reja 2022-12-15 15:36:12 +00:00
commit 7a5226b825
27 changed files with 268 additions and 94 deletions

View File

@ -1,5 +1,8 @@
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';
DROP TABLE IF EXISTS `tphase`;
DROP TABLE IF EXISTS `ttransaction`;

View File

@ -169,6 +169,7 @@ $visual_format = 0;
$filter_search = '';
$filter_exclude = '';
$use_prefix_notation = true;
// Added for select fields.
$total_time = true;
@ -461,6 +462,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':
@ -476,6 +478,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':
@ -491,6 +494,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':
@ -504,6 +508,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':
@ -773,6 +778,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
@ -3404,6 +3410,22 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_use_prefix_notation" class="datos advanced_elements">
<td class="bolder">
<?php
echo __('Use prefix notation');
ui_print_help_tip(
__('Use prefix notation for numeric values (example: 20,8Kbytes/sec), otherwise full value will be displayed (example: 20.742 bytes/sec)')
);
?>
</td>
<td>
<?php
html_print_checkbox_switch('use_prefix_notation', 1, $use_prefix_notation);
?>
</td>
</tr>
<tr id="row_uncompressed_module" class="datos">
<td class="bolder">
<?php
@ -6367,6 +6389,7 @@ function chooseType() {
$("#row_show_summary").hide();
$("#row_group_by").hide();
$("#row_type_show").hide();
$("#row_use_prefix_notation").hide();
// SLA list default state.
$("#sla_list").hide();
@ -6561,6 +6584,7 @@ function chooseType() {
$("#row_lapse").show();
$("#row_visual_format").show();
$("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break;
case 'max_value':
@ -6572,6 +6596,7 @@ function chooseType() {
$("#row_lapse").show();
$("#row_visual_format").show();
$("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break;
case 'min_value':
@ -6583,6 +6608,7 @@ function chooseType() {
$("#row_lapse").show();
$("#row_visual_format").show();
$("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break;
case 'sumatory':
@ -6592,6 +6618,7 @@ function chooseType() {
$("#row_period").show();
$("#row_historical_db_check").hide();
$("#row_uncompressed_module").show();
$("#row_use_prefix_notation").show();
break;
case 'historical_data':
@ -6879,6 +6906,7 @@ function chooseType() {
$("#row_show_resume").show();
$("#row_show_graph").show();
$("#row_historical_db_check").hide();
$("#row_use_prefix_notation").show();
break;
case 'exception':

View File

@ -1888,6 +1888,9 @@ switch ($action) {
$values['visual_format'] = get_parameter(
'visual_format'
);
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true;
break;
@ -1911,6 +1914,9 @@ switch ($action) {
$values['show_graph'] = get_parameter(
'combo_graph_options'
);
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true;
break;
}
@ -2704,6 +2710,9 @@ switch ($action) {
$values['visual_format'] = get_parameter(
'visual_format'
);
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true;
break;
@ -2720,6 +2729,9 @@ switch ($action) {
$values['show_graph'] = get_parameter(
'combo_graph_options'
);
$values['use_prefix_notation'] = get_parameter(
'use_prefix_notation'
);
$good_format = true;
break;
}

View File

@ -1312,6 +1312,27 @@ $table_other->data[$row][1] = '<em>'.__('Example').'</em> '.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;

View File

@ -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 {

View File

@ -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']
)
);
}

View File

@ -2636,6 +2636,8 @@ class AgentWizard extends HTML
*/
private function resultsInterfaceWizard()
{
global $config;
$generalInterfaceModules = $this->getInterfacesModules();
$generalInterfaceTables = [];
$generalInterfaceModulesUpdated = [];
@ -2849,7 +2851,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.

View File

@ -987,7 +987,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'),
@ -1122,7 +1122,9 @@ class Diagnostics extends Wizard
if ($totalModuleIntervalTime !== false) {
$averageTime = number_format(
((int) $totalNetworkModules / (int) $totalModuleIntervalTime),
3
3,
$config['decimal_separator'],
$config['thousand_separator']
);
}
@ -1749,7 +1751,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) {

View File

@ -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;
}

View File

@ -1475,6 +1475,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':
@ -3479,6 +3488,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();
}

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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;
}
@ -6917,6 +6938,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,
@ -7077,6 +7105,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);

View File

@ -2292,7 +2292,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 {
@ -2785,7 +2787,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'])),
];
}
@ -2925,7 +2927,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 {
@ -3470,7 +3474,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']
)
).' %</p>';
@ -3481,7 +3487,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']
)
).' % '.'</p>';
}
@ -3835,7 +3843,9 @@ function reporting_html_value(
remove_right_zeros(
number_format(
$data[__('Maximun')],
$config['graph_precision']
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
),
];

View File

@ -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 = "<span title='".$last_data['datos']."' class='nowrap'>".human_milliseconds_to_string($last_data['datos']).'</span>';
} else if (is_numeric($last_data['datos'])) {
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>';
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} 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 = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>';
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} 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 = "<span title='".human_milliseconds_to_string($last_data['datos'])."' class='nowrap'>".human_milliseconds_to_string($last_data['datos']).'</span>';
} else if (is_numeric($last_data['datos'])) {
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>';
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} 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 = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'])).'</span>';
$data = "<span class='span_treeview'>".remove_right_zeros(number_format($last_data['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} 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 = "<span class='span_treeview'>".remove_right_zeros(number_format($data_macro, $config['graph_precision'])).'</span>';
$last_data_str = "<span class='span_treeview'>".remove_right_zeros(number_format($data_macro, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])).'</span>';
} else {
$last_data_str = ui_print_truncate_text(
io_safe_output($data_macro),

View File

@ -6592,10 +6592,11 @@ function ui_print_comments($comments)
} else {
$rest_time = (time() - $last_comment['utimestamp']);
$time_last = (($rest_time / 60) / 60);
$comentario = '<i>'.number_format($time_last, 0).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$last_comment['comment'].'';
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$last_comment['comment'].'';
if (strlen($comentario) > '200px') {
$comentario = '<i>'.number_format($time_last, 0).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$short_comment.'...';
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$short_comment.'...';
}
}

View File

@ -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 .= ' <br>'.__('Last value: ').remove_right_zeros(number_format($value, $config['graph_precision']));
$img_style_title .= ' <br>'.__('Last value: ').remove_right_zeros(number_format($value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
} else {
$img_style_title .= ' <br>'.__('Last value: ').$value;
}
@ -1881,13 +1881,13 @@ function visual_map_print_item(
echo '</tr>';
echo "<tr class='bg_whitesmoke height_90p'>";
echo '<td>';
echo "<div class='critical_zeros'>".remove_right_zeros(number_format($stat_agent_cr, 2)).'%</div>';
echo "<div class='critical_zeros'>".remove_right_zeros(number_format($stat_agent_cr, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='critical_vm'>Critical</div>";
echo "<div class='warning_zeros'>".remove_right_zeros(number_format($stat_agent_wa, 2)).'%</div>';
echo "<div class='warning_zeros'>".remove_right_zeros(number_format($stat_agent_wa, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='warning_vm'>Warning</div>";
echo "<div class='normal_zeros'>".remove_right_zeros(number_format($stat_agent_ok, 2)).'%</div>';
echo "<div class='normal_zeros'>".remove_right_zeros(number_format($stat_agent_ok, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='normal_vm'>Normal</div>";
echo "<div class='unknown_zeros'>".remove_right_zeros(number_format($stat_agent_un, 2)).'%</div>';
echo "<div class='unknown_zeros'>".remove_right_zeros(number_format($stat_agent_un, 2, $config['decimal_separator'], $config['thousand_separator'])).'%</div>';
echo "<div class='unknown_vm'>Unknown</div>";
echo '</td>';
echo '</tr>';
@ -2462,7 +2462,7 @@ function visual_map_get_simple_value($type, $id_module, $period=SECONDS_1DAY)
} else {
if (is_numeric($value)) {
if ($config['simple_module_value']) {
$value = remove_right_zeros(number_format($value, $config['graph_precision']));
$value = remove_right_zeros(number_format($value, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
}
}

View File

@ -499,11 +499,11 @@ function flot_custom_pie_chart(
foreach ($graph_values as $label => $value) {
if ($value['value']) {
if ($value['value'] > 1000000) {
$legendvalue = sprintf('%sM', remove_right_zeros(number_format(($value['value'] / 1000000), $config['graph_precision'])));
$legendvalue = sprintf('%sM', remove_right_zeros(number_format(($value['value'] / 1000000), $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])));
} else if ($value['value'] > 1000) {
$legendvalue = sprintf('%sK', remove_right_zeros(number_format(($value['value'] / 1000), $config['graph_precision'])));
$legendvalue = sprintf('%sK', remove_right_zeros(number_format(($value['value'] / 1000), $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])));
} else {
$legendvalue = remove_right_zeros(number_format($value['value'], $config['graph_precision']));
$legendvalue = remove_right_zeros(number_format($value['value'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']));
}
} else {
$legendvalue = __('No data');

View File

@ -555,7 +555,7 @@ class ModuleIconWidget extends Widget
// Div value.
$output .= '<div style="flex: 0 1 10px; font-size:'.$sizeValue.'px;">';
$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 .= '</div>';

View File

@ -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 {

View File

@ -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 = '<div class="group-container">';
$html .= '<div class="group-item-title">';

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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;
}
}

View File

@ -1624,6 +1624,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
@ -3255,6 +3256,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;

View File

@ -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] = '<b>'.__('Power utilization')." $percent%</b>";
$data[0] .= progress_bar($percent, 400, 30, '', 2);
$data[0] .= '<br><br>';
$data[0] .= '<b>'.__('Current stats').'</b>';
$data[0] .= '<br><br>';
$data[0] .= __('Power demand').': <b>'.number_format($avg_power, 2).' Wh</b>';
$data[0] .= __('Power demand').': <b>'.number_format($avg_power, 2, $config['decimal_separator'], $config['thousand_separator']).' Wh</b>';
$data[0] .= '<br>';
$data[0] .= __('Inlet temp').': <b>'.number_format($avg_temp, 2).' ºC</b>';
$data[0] .= __('Inlet temp').': <b>'.number_format($avg_temp, 2, $config['decimal_separator'], $config['thousand_separator']).' ºC</b>';
$data[0] .= '<br><br><br>';
$data[0] .= '<b>'.__('Last week summary').'</b>';
$data[0] .= '<br><br>';
$data[0] .= __('Equipment energy consumed').': <b>'.number_format($mnged_energy, 2).' Wh</b>';
$data[0] .= __('Equipment energy consumed').': <b>'.number_format($mnged_energy, 2, $config['decimal_separator'], $config['thousand_separator']).' Wh</b>';
$data[0] .= '<br>';
$data[0] .= __('Equipment energy bill').': <b>'.number_format($mnged_energy_bill, 2).' €</b>';
$data[0] .= __('Equipment energy bill').': <b>'.number_format($mnged_energy_bill, 2, $config['decimal_separator'], $config['thousand_separator']).' €</b>';
$data[0] .= '<br>';
$data[0] .= __('Calculated cooling energy').': <b>'.number_format($cooling_energy, 2).' Wh</b>';
$data[0] .= __('Calculated cooling energy').': <b>'.number_format($cooling_energy, 2, $config['decimal_separator'], $config['thousand_separator']).' Wh</b>';
$data[0] .= '<br>';
$data[0] .= __('Calculated cooling energy bill').': <b>'.number_format($cooling_energy_bill, 2).' €</b>';
$data[0] .= __('Calculated cooling energy bill').': <b>'.number_format($cooling_energy_bill, 2, $config['decimal_separator'], $config['thousand_separator']).' €</b>';
// Print avg. power graph
$start_date = date('Y-m-d');