From 8ab343e95ff0e5f52595355c1abae9cac1f23e26 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Mar 2016 23:17:46 +0100 Subject: [PATCH] Can choose number of decimals into function showDimensionInBestUnit --- htdocs/core/lib/functions.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ebe5509078d..162e88a8e4b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3418,9 +3418,10 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) * @param int $unit Unit of dimension (0, -3, ...) * @param string $type 'weight', 'volume', ... * @param Translate $outputlangs Translate language object + * @param int $round -1 = non rounding, x = number of decimal * @return string String to show dimensions */ -function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs) +function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1) { if ($dimension < 1/10000) { @@ -3443,7 +3444,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs) $unit = $unit + 3; } - $ret=price($dimension, 0, $outputlangs, 0, 0).' '.measuring_units_string($unit, $type); + $ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type); return $ret; }