fix bug when deleting custom units and changed default value for byte multiplier

This commit is contained in:
alejandro-campos 2020-01-15 16:00:33 +01:00
parent 7c952eaaa8
commit 3f26f2ef6f
4 changed files with 6 additions and 6 deletions

View File

@ -1361,7 +1361,7 @@ $row++;
$options_data_multiplier[1] = __('Use always 1000');
$options_data_multiplier[2] = __('Use always 1024');
$table_other->data[$row][1] = html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 0, true, false, false);
$table_other->data[$row][1] = html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false);
echo '<fieldset>';

View File

@ -5543,7 +5543,7 @@ function delete_custom_module_unit($value)
$custom_units = get_custom_module_units();
unset($custom_units[$value]);
unset($custom_units[io_safe_output($value)]);
$new_conf = json_encode($custom_units);
$return = config_update_value(
@ -5574,7 +5574,7 @@ function get_data_multiplier($unit)
switch ($config['use_data_multiplier']) {
case 0:
if (strpos($unit, 'yte') !== false) {
if (strpos(strtolower($unit), 'yte') !== false) {
$multiplier = 1024;
} else {
$multiplier = 1000;

View File

@ -2831,7 +2831,7 @@ function config_process_config()
}
if (!isset($config['use_data_multiplier'])) {
config_update_value('use_data_multiplier', ';');
config_update_value('use_data_multiplier', '1');
}
if (!isset($config['command_snapshot'])) {

View File

@ -712,7 +712,7 @@ function post_process_select_init_unit(name, selected) {
});
if (select_or_text) {
$("#" + name + "_select option[value=" + selected + "]").attr(
$("#" + name + "_select option[value='" + selected + "']").attr(
"selected",
true
);
@ -728,7 +728,7 @@ function post_process_select_init_unit(name, selected) {
$("#" + name + "_select").change(function() {
var value = $("#" + name + "_select").val();
$("#" + name + "_select option[value=" + value + "]").attr(
$("#" + name + "_select option[value='" + value + "']").attr(
"selected",
true
);