[*] FO : Merge of https://github.com/PrestaShop/PrestaShop/pull/820 + https://github.com/PrestaShop/PrestaShop/commit/5e407db21e3e30a1a5fa94b9558314ffa21af407
This commit is contained in:
@@ -30,12 +30,12 @@ function ps_round(value, precision)
|
|||||||
if (typeof(precision) === 'undefined')
|
if (typeof(precision) === 'undefined')
|
||||||
precision = 2;
|
precision = 2;
|
||||||
|
|
||||||
method = roundMode;
|
var method = roundMode;
|
||||||
if (method === 0)
|
if (method === 0)
|
||||||
return ceilf(value, precision);
|
return ceilf(value, precision);
|
||||||
else if (method === 1)
|
else if (method === 1)
|
||||||
return floorf(value, precision);
|
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;
|
return Math.round(value * precisionFactor) / precisionFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,9 +43,9 @@ function ceilf(value, precision)
|
|||||||
{
|
{
|
||||||
if (typeof(precision) === 'undefined')
|
if (typeof(precision) === 'undefined')
|
||||||
precision = 0;
|
precision = 0;
|
||||||
precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
|
var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
|
||||||
tmp = value * precisionFactor;
|
var tmp = value * precisionFactor;
|
||||||
tmp2 = tmp.toString();
|
var tmp2 = tmp.toString();
|
||||||
if (tmp2[tmp2.length - 1] === 0)
|
if (tmp2[tmp2.length - 1] === 0)
|
||||||
return value;
|
return value;
|
||||||
return Math.ceil(value * precisionFactor) / precisionFactor;
|
return Math.ceil(value * precisionFactor) / precisionFactor;
|
||||||
@@ -55,9 +55,9 @@ function floorf(value, precision)
|
|||||||
{
|
{
|
||||||
if (typeof(precision) === 'undefined')
|
if (typeof(precision) === 'undefined')
|
||||||
precision = 0;
|
precision = 0;
|
||||||
precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
|
var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
|
||||||
tmp = value * precisionFactor;
|
var tmp = value * precisionFactor;
|
||||||
tmp2 = tmp.toString();
|
var tmp2 = tmp.toString();
|
||||||
if (tmp2[tmp2.length - 1] === 0)
|
if (tmp2[tmp2.length - 1] === 0)
|
||||||
return value;
|
return value;
|
||||||
return Math.floor(value * precisionFactor) / precisionFactor;
|
return Math.floor(value * precisionFactor) / precisionFactor;
|
||||||
@@ -81,7 +81,7 @@ function formatedNumberToFloat(price, currencyFormat, currencySign)
|
|||||||
function formatCurrency(price, currencyFormat, currencySign, currencyBlank)
|
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)
|
// 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 = parseFloat(price.toFixed(6));
|
||||||
price = ps_round(price, priceDisplayPrecision);
|
price = ps_round(price, priceDisplayPrecision);
|
||||||
if (currencyBlank > 0)
|
if (currencyBlank > 0)
|
||||||
@@ -95,7 +95,7 @@ function formatCurrency(price, currencyFormat, currencySign, currencyBlank)
|
|||||||
if (currencyFormat == 4)
|
if (currencyFormat == 4)
|
||||||
return (formatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign);
|
return (formatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign);
|
||||||
if (currencyFormat == 5)
|
if (currencyFormat == 5)
|
||||||
return (formatNumber(price, priceDisplayPrecision, ' ', '.') + blank + currencySign);
|
return (currencySign + blank + formatNumber(price, priceDisplayPrecision, '\'', '.'));
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -30,12 +30,12 @@ function ps_round(value, precision)
|
|||||||
if (typeof(precision) === 'undefined')
|
if (typeof(precision) === 'undefined')
|
||||||
precision = 2;
|
precision = 2;
|
||||||
|
|
||||||
method = roundMode;
|
var method = roundMode;
|
||||||
if (method === 0)
|
if (method === 0)
|
||||||
return ceilf(value, precision);
|
return ceilf(value, precision);
|
||||||
else if (method === 1)
|
else if (method === 1)
|
||||||
return floorf(value, precision);
|
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;
|
return Math.round(value * precisionFactor) / precisionFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,9 +43,9 @@ function ceilf(value, precision)
|
|||||||
{
|
{
|
||||||
if (typeof(precision) === 'undefined')
|
if (typeof(precision) === 'undefined')
|
||||||
precision = 0;
|
precision = 0;
|
||||||
precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
|
var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
|
||||||
tmp = value * precisionFactor;
|
var tmp = value * precisionFactor;
|
||||||
tmp2 = tmp.toString();
|
var tmp2 = tmp.toString();
|
||||||
if (tmp2[tmp2.length - 1] === 0)
|
if (tmp2[tmp2.length - 1] === 0)
|
||||||
return value;
|
return value;
|
||||||
return Math.ceil(value * precisionFactor) / precisionFactor;
|
return Math.ceil(value * precisionFactor) / precisionFactor;
|
||||||
@@ -55,9 +55,9 @@ function floorf(value, precision)
|
|||||||
{
|
{
|
||||||
if (typeof(precision) === 'undefined')
|
if (typeof(precision) === 'undefined')
|
||||||
precision = 0;
|
precision = 0;
|
||||||
precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
|
var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision);
|
||||||
tmp = value * precisionFactor;
|
var tmp = value * precisionFactor;
|
||||||
tmp2 = tmp.toString();
|
var tmp2 = tmp.toString();
|
||||||
if (tmp2[tmp2.length - 1] === 0)
|
if (tmp2[tmp2.length - 1] === 0)
|
||||||
return value;
|
return value;
|
||||||
return Math.floor(value * precisionFactor) / precisionFactor;
|
return Math.floor(value * precisionFactor) / precisionFactor;
|
||||||
@@ -81,7 +81,7 @@ function formatedNumberToFloat(price, currencyFormat, currencySign)
|
|||||||
function formatCurrency(price, currencyFormat, currencySign, currencyBlank)
|
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)
|
// 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 = parseFloat(price.toFixed(6));
|
||||||
price = ps_round(price, priceDisplayPrecision);
|
price = ps_round(price, priceDisplayPrecision);
|
||||||
if (currencyBlank > 0)
|
if (currencyBlank > 0)
|
||||||
@@ -212,7 +212,7 @@ function in_array(value, array)
|
|||||||
|
|
||||||
function resizeAddressesBox(nameBox)
|
function resizeAddressesBox(nameBox)
|
||||||
{
|
{
|
||||||
maxHeight = 0;
|
var maxHeight = 0;
|
||||||
|
|
||||||
if (typeof(nameBox) === 'undefined')
|
if (typeof(nameBox) === 'undefined')
|
||||||
nameBox = '.address';
|
nameBox = '.address';
|
||||||
|
|||||||
Reference in New Issue
Block a user