Bladeren bron

Merge branch 'dev'

prodstable
Guillaume Bourgeois 4 jaren geleden
bovenliggende
commit
32a26aa55f
3 gewijzigde bestanden met toevoegingen van 7 en 7 verwijderingen
  1. +1
    -1
      backend/web/js/backend.js
  2. +1
    -1
      common/helpers/Price.php
  3. +5
    -5
      common/web/js/utils.js

+ 1
- 1
backend/web/js/backend.js Bestand weergeven

@@ -89,7 +89,7 @@ function opendistrib_products_event_price_with_tax() {
}
$('#product-price-with-tax').val(getPriceWithTax($('#product-price').val(), taxRateSelected));
//formattage des prix
$('#product-price').val(parseFloat($('#product-price').val()).toFixed(2));
$('#product-price').val(parseFloat($('#product-price').val()).toFixed(3));
}
function opendistrib_products_event_price(){
taxRateSelected = $('#product-id_tax_rate').find('option:selected').data('tax-rate-value');

+ 1
- 1
common/helpers/Price.php Bestand weergeven

@@ -58,7 +58,7 @@ class Price

public static function numberTwoDecimals($number)
{
return number_format(((int) ($number * 100)) / 100, 2) ;
return number_format(( ($number * 100)) / 100, 2) ;
}

}

+ 5
- 5
common/web/js/utils.js Bestand weergeven

@@ -10,7 +10,7 @@
* @returns {string}
*/
function getPrice(priceWithTax, taxRate) {
return numberTwoDecimals(parseFloat(parseFloat(priceWithTax) / (taxRate + 1)));
return numberDecimals(parseFloat(parseFloat(priceWithTax) / (taxRate + 1)), 3);
}

/**
@@ -21,11 +21,11 @@ function getPrice(priceWithTax, taxRate) {
* @returns {string}
*/
function getPriceWithTax(priceWithoutTax, taxRate) {
return numberTwoDecimals(parseFloat(parseFloat(priceWithoutTax) * (taxRate + 1)));
return numberDecimals(parseFloat(parseFloat(priceWithoutTax) * (taxRate + 1)), 2);
}

function numberTwoDecimals(num) {
return (parseInt((num * 100)) / 100).toFixed(2) ;
function numberDecimals(num, decimals) {
return Number(num).toFixed(decimals) ;
}

/**
@@ -35,7 +35,7 @@ function numberTwoDecimals(num) {
* @returns {string}
*/
function formatPrice(price) {
return Number(price).toFixed(2).replace('.', ',') + ' €';
return numberTwoDecimals(price).replace('.', ',') + ' €';
}

/**

Laden…
Annuleren
Opslaan