diff --git a/changelog/74_UNRELEASED_xxxx-xx-xx.md b/changelog/74_UNRELEASED_xxxx-xx-xx.md
index aa4f3704..805ac659 100644
--- a/changelog/74_UNRELEASED_xxxx-xx-xx.md
+++ b/changelog/74_UNRELEASED_xxxx-xx-xx.md
@@ -17,6 +17,8 @@
- Fixed that the location dropdown on the consume page contained the same location multiple times if there are currently stock entries at multiple locations of the corresponding product
- Fixed that the status filter "n products are overdue" on the stock overview page also counted/included stock entries due today or tomorrow
- Fixed that the stock report "Spendings" did not take products without an assigned product group into account (thanks @Torqu3Wr3nch for the initial work on this)
+- Fixed that the success message after opening a stock entry on the stock entries page displayed always an amount of `1` instead of the actual amount opened
+- Fixed that the "Consume this stock entry as spoiled" context menu action on the stock entries page consumed alway `1` instead of the whole stock entry
### Shopping list
diff --git a/public/viewjs/stockentries.js b/public/viewjs/stockentries.js
index 9b6a8e7b..15d5602c 100644
--- a/public/viewjs/stockentries.js
+++ b/public/viewjs/stockentries.js
@@ -79,11 +79,12 @@ $(document).on('click', '.stock-consume-button', function(e)
Grocy.Api.Get('stock/products/' + productId,
function(result)
{
- var toastMessage = __t('Removed %1$s of %2$s from stock', consumeAmount.toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(consumeAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural, true), result.product.name) + '
' + __t("Undo") + '';
+ var toastMessage = __t('Removed %1$s of %2$s from stock', consumeAmount.toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(consumeAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural, true), result.product.name);
if (wasSpoiled)
{
- toastMessage += " (" + __t("Spoiled") + ")";
+ toastMessage += "
(" + __t("Spoiled") + ")";
}
+ toastMessage += '
' + __t("Undo") + '';
Grocy.FrontendHelpers.EndUiBusy();
RefreshStockEntryRow(stockRowId);
@@ -113,8 +114,6 @@ $(document).on('click', '.product-open-button', function(e)
Grocy.FrontendHelpers.BeginUiBusy();
var productId = $(e.currentTarget).attr('data-product-id');
- var productName = $(e.currentTarget).attr('data-product-name');
- var productQuName = $(e.currentTarget).attr('data-product-qu-name');
var specificStockEntryId = $(e.currentTarget).attr('data-stock-id');
var stockRowId = $(e.currentTarget).attr('data-stockrow-id');
var openAmount = Number.parseFloat($(e.currentTarget).attr('data-open-amount'));
@@ -128,7 +127,7 @@ $(document).on('click', '.product-open-button', function(e)
{
button.addClass("disabled");
Grocy.FrontendHelpers.EndUiBusy();
- toastr.success(__t('Marked %1$s of %2$s as opened', 1 + " " + productQuName, productName) + '
' + __t("Undo") + '');
+ toastr.success(__t('Marked %1$s of %2$s as opened', openAmount.toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(openAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural, true), result.product.name) + '
' + __t("Undo") + '');
if (result.product.move_on_open == 1 && result.default_consume_location != null)
{
diff --git a/views/stockentries.blade.php b/views/stockentries.blade.php
index 1bce8905..4b18fd9a 100644
--- a/views/stockentries.blade.php
+++ b/views/stockentries.blade.php
@@ -188,7 +188,7 @@
data-stock-id="{{ $stockEntry->stock_id }}"
data-stockrow-id="{{ $stockEntry->id }}"
data-location-id="{{ $stockEntry->location_id }}"
- data-consume-amount="1">
+ data-consume-amount="{{ $stockEntry->amount }}">
{{ $__t('Consume this stock entry as spoiled', '1 ' . FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name) }}
@if(GROCY_FEATURE_FLAG_RECIPES)