diff --git a/changelog/72_UNRELEASED_xxxx-xx-xx.md b/changelog/72_UNRELEASED_xxxx-xx-xx.md index 49fa3dc4..e195e950 100644 --- a/changelog/72_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/72_UNRELEASED_xxxx-xx-xx.md @@ -10,6 +10,7 @@ ### Stock +- Fixed that the "Mark this stock entry as open"-button on the stock entries page opened always one unit instead of the whole stock entry - Fixed that edited stock entries were not considered in some cases (affecting the product's average price and the stock reports) ### Shopping list diff --git a/public/viewjs/stockentries.js b/public/viewjs/stockentries.js index 22891de0..9b6a8e7b 100644 --- a/public/viewjs/stockentries.js +++ b/public/viewjs/stockentries.js @@ -117,9 +117,10 @@ $(document).on('click', '.product-open-button', function(e) 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')); var button = $(e.currentTarget); - Grocy.Api.Post('stock/products/' + productId + '/open', { 'amount': 1, 'stock_entry_id': specificStockEntryId }, + Grocy.Api.Post('stock/products/' + productId + '/open', { 'amount': openAmount, 'stock_entry_id': specificStockEntryId }, function(bookingResponse) { Grocy.Api.Get('stock/products/' + productId, diff --git a/views/stockentries.blade.php b/views/stockentries.blade.php index f8e84037..1bce8905 100644 --- a/views/stockentries.blade.php +++ b/views/stockentries.blade.php @@ -130,7 +130,8 @@ data-product-name="{{ FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name }}" data-product-qu-name="{{ FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name }}" data-stock-id="{{ $stockEntry->stock_id }}" - data-stockrow-id="{{ $stockEntry->id }}"> + data-stockrow-id="{{ $stockEntry->id }}" + data-open-amount="{{ $stockEntry->amount }}"> @endif