gRoussac
2013-11-26 22:49:10 +01:00
parent b8012952f7
commit 9ccd4504f4
2 changed files with 20 additions and 20 deletions
+10 -10
View File
@@ -30,12 +30,12 @@ function ps_round(value, precision)
if (typeof(precision) === 'undefined')
precision = 2;
method = roundMode;
var method = roundMode;
if (method === 0)
return ceilf(value, precision);
else if (method === 1)
return floorf(value, precision);
precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
return Math.round(value * precisionFactor) / precisionFactor;
}
@@ -43,9 +43,9 @@ function ceilf(value, precision)
{
if (typeof(precision) === 'undefined')
precision = 0;
precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
tmp = value * precisionFactor;
tmp2 = tmp.toString();
var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
var tmp = value * precisionFactor;
var tmp2 = tmp.toString();
if (tmp2[tmp2.length - 1] === 0)
return value;
return Math.ceil(value * precisionFactor) / precisionFactor;
@@ -55,9 +55,9 @@ function floorf(value, precision)
{
if (typeof(precision) === 'undefined')
precision = 0;
precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
tmp = value * precisionFactor;
tmp2 = tmp.toString();
var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
var tmp = value * precisionFactor;
var tmp2 = tmp.toString();
if (tmp2[tmp2.length - 1] === 0)
return value;
return Math.floor(value * precisionFactor) / precisionFactor;
@@ -81,7 +81,7 @@ function formatedNumberToFloat(price, currencyFormat, currencySign)
function formatCurrency(price, currencyFormat, currencySign, currencyBlank)
{
// if you modified this function, don't forget to modify the PHP function displayPrice (in the Tools.php class)
blank = '';
var blank = '';
price = parseFloat(price.toFixed(6));
price = ps_round(price, priceDisplayPrecision);
if (currencyBlank > 0)
@@ -95,7 +95,7 @@ function formatCurrency(price, currencyFormat, currencySign, currencyBlank)
if (currencyFormat == 4)
return (formatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign);
if (currencyFormat == 5)
return (formatNumber(price, priceDisplayPrecision, ' ', '.') + blank + currencySign);
return (currencySign + blank + formatNumber(price, priceDisplayPrecision, '\'', '.'));
return price;
}
+10 -10
View File
@@ -30,12 +30,12 @@ function ps_round(value, precision)
if (typeof(precision) === 'undefined')
precision = 2;
method = roundMode;
var method = roundMode;
if (method === 0)
return ceilf(value, precision);
else if (method === 1)
return floorf(value, precision);
precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
return Math.round(value * precisionFactor) / precisionFactor;
}
@@ -43,9 +43,9 @@ function ceilf(value, precision)
{
if (typeof(precision) === 'undefined')
precision = 0;
precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
tmp = value * precisionFactor;
tmp2 = tmp.toString();
var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
var tmp = value * precisionFactor;
var tmp2 = tmp.toString();
if (tmp2[tmp2.length - 1] === 0)
return value;
return Math.ceil(value * precisionFactor) / precisionFactor;
@@ -55,9 +55,9 @@ function floorf(value, precision)
{
if (typeof(precision) === 'undefined')
precision = 0;
precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
tmp = value * precisionFactor;
tmp2 = tmp.toString();
var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
var tmp = value * precisionFactor;
var tmp2 = tmp.toString();
if (tmp2[tmp2.length - 1] === 0)
return value;
return Math.floor(value * precisionFactor) / precisionFactor;
@@ -81,7 +81,7 @@ function formatedNumberToFloat(price, currencyFormat, currencySign)
function formatCurrency(price, currencyFormat, currencySign, currencyBlank)
{
// if you modified this function, don't forget to modify the PHP function displayPrice (in the Tools.php class)
blank = '';
var blank = '';
price = parseFloat(price.toFixed(6));
price = ps_round(price, priceDisplayPrecision);
if (currencyBlank > 0)
@@ -212,7 +212,7 @@ function in_array(value, array)
function resizeAddressesBox(nameBox)
{
maxHeight = 0;
var maxHeight = 0;
if (typeof(nameBox) === 'undefined')
nameBox = '.address';