From e039db22f5fea2040129022dba0678060605e703 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Mon, 24 Aug 2020 17:42:41 +0200 Subject: [PATCH] Don't prefill for empty prices when editing a stock entry (fixes #961) --- changelog/60_UNRELEASED_2020-xx-xx.md | 1 + views/stockentryform.blade.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/changelog/60_UNRELEASED_2020-xx-xx.md b/changelog/60_UNRELEASED_2020-xx-xx.md index 774afac2..1d3d241f 100644 --- a/changelog/60_UNRELEASED_2020-xx-xx.md +++ b/changelog/60_UNRELEASED_2020-xx-xx.md @@ -24,6 +24,7 @@ - Fixed that `FEATURE_SETTING_STOCK_COUNT_OPENED_PRODUCTS_AGAINST_MINIMUM_STOCK_AMOUNT` (option to configure if opened products should be considered for minimum stock amounts) was not handled correctly (thanks @teddybeermaniac) - Fixed that the "Expiring soon" sum (yellow header-button) on the stock overview page didn't include products which expire today (thanks @fipwmaqzufheoxq92ebc) - Fixed that the shopping cart icon on the stock overview page was also shown if the product was on an already deleted shopping list (if enabled) (thanks @fipwmaqzufheoxq92ebc) +- Fixed that when editing a stock entry without a price, the price field was prefilled with `1` ### Recipe improvements/fixes - It's now possible to print recipes (button next to the recipe title) (thanks @zsarnett) diff --git a/views/stockentryform.blade.php b/views/stockentryform.blade.php index 39a55c1e..f28f7ea8 100644 --- a/views/stockentryform.blade.php +++ b/views/stockentryform.blade.php @@ -71,9 +71,19 @@ )) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) + @php + if (empty($stockEntry->price)) + { + $price = ''; + } + else + { + $price = $stockEntry->price; + } + @endphp @include('components.numberpicker', array( 'id' => 'price', - 'value' => $stockEntry->price, + 'value' => $price, 'label' => 'Price', 'min' => 0, 'step' => 0.01,