Browse Source

Protect against bad value of accurancy to avoid javascript error

Laurent Destailleur 9 years ago
parent
commit
d717757594
1 changed files with 3 additions and 3 deletions
  1. 3 3
      htdocs/core/js/lib_head.js.php

+ 3 - 3
htdocs/core/js/lib_head.js.php

@@ -1035,9 +1035,9 @@ function price2numjs(amount) {
 		print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n";    // Set var in javascript
 	?>
 
-	var main_max_dec_shown = <?php echo str_replace('.', '', $conf->global->MAIN_MAX_DECIMALS_SHOWN); ?>;
-	var main_rounding_unit = <?php echo $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
-	var main_rounding_tot = <?php echo $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
+	var main_max_dec_shown = <?php echo (int) str_replace('.', '', $conf->global->MAIN_MAX_DECIMALS_SHOWN); ?>;
+	var main_rounding_unit = <?php echo (int) $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
+	var main_rounding_tot = <?php echo (int) $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
 
 	var amount = amount.toString();