From fbb8999513af99fe01e1e961d9fec5d0f6677f09 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Wed, 22 Apr 2020 18:00:25 +0200 Subject: [PATCH] Fixes and changelog for #767 --- changelog/60_UNRELEASED_2020-xx-xx.md | 8 +++++++- localization/strings.pot | 3 +++ public/viewjs/purchase.js | 8 +++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/changelog/60_UNRELEASED_2020-xx-xx.md b/changelog/60_UNRELEASED_2020-xx-xx.md index 8a1d3698..c2b47046 100644 --- a/changelog/60_UNRELEASED_2020-xx-xx.md +++ b/changelog/60_UNRELEASED_2020-xx-xx.md @@ -1,8 +1,14 @@ -### Stock fixes +### Stock improvements/fixes +- Optimized/clarified what the total/unit price is on the purchase page (thanks @kriddles) +- On the purchase page the amount field is now displayed above/before the best before date for better `TAB` handling (thanks @kriddles) +- Changed that when `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING` is disabled, products now get internally a best before of "never expires" (aka `2999-12-31`) instead of today (thanks @kriddles) - Fixed that it was not possible to leave the "Barcode(s)" on the product edit page by `TAB` ### Calendar fixes - Fixed a PHP warning when using the "Share/Integrate calendar (iCal)" button (thanks @tsia) +### API fixes +- Fixed (again) that CORS was broken + ### General & other improvements - UI refresh / style improvements (thanks @zsarnett) diff --git a/localization/strings.pot b/localization/strings.pot index 8664ed79..6127c1a3 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -1795,3 +1795,6 @@ msgstr "" msgid "By default the amount to be added to the shopping list is `needed amount - stock amount - shopping list amount` - when this is enabled, it is only checked against the stock amount, not against what is already on the shopping list" msgstr "" + +msgid "means %1$s per %2$s" +msgstr "" diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js index ea2245aa..2f5ebad7 100644 --- a/public/viewjs/purchase.js +++ b/public/viewjs/purchase.js @@ -360,18 +360,16 @@ function refreshPriceHint() if ($("input[name='price-type']:checked").val() == "total-price") { - var priceTypeUnitPrice = $("#price-type-unit-price"); - var priceTypeUnitPriceLabel = $("[for=" + priceTypeUnitPrice.attr("id") + "]"); - var price = $('#price').val() / $('#amount').val(); + var price = parseFloat($('#price').val()) / parseFloat($('#amount').val()); - $('#price-hint').text('(will result with ' + priceTypeUnitPriceLabel.text() + ' cost of ' + price.toFixed(2) + ')'); + $('#price-hint').text(__t('means %1$s per %2$s', price.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: 2 }), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name"))); } else { if (document.getElementById("amount_qu_unit").getAttribute("qu-factor-purchase-to-stock") > 1) { var price = $('#price').val() / document.getElementById("amount_qu_unit").getAttribute("qu-factor-purchase-to-stock"); - $('#price-hint').text('(will result with ' + document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name") + ' cost of ' + price.toFixed(2) + ')'); + $('#price-hint').text(__t('means %1$s per %2$s', price.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: 2 }), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name"))); } else {