From 9dbd6a68c4afa0863ff1843921720032791befda Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 12 Apr 2020 13:55:26 +0200 Subject: [PATCH] Don't change the displayed QU to the products stock QU when "Only check if a single unit is in stock" is set when editing a recipe ingredient (fixes #606) --- changelog/58_UNRELEASED_2020-xx-xx.md | 1 + public/viewjs/recipeposform.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog/58_UNRELEASED_2020-xx-xx.md b/changelog/58_UNRELEASED_2020-xx-xx.md index ba87ead9..d759fbfb 100644 --- a/changelog/58_UNRELEASED_2020-xx-xx.md +++ b/changelog/58_UNRELEASED_2020-xx-xx.md @@ -9,6 +9,7 @@ - When creating a new product, the "QU id stock" is now preset by the "QU id purchase" (because most of the time that's most probably the same) (thanks @Mik-) ### Recipe fixes +- Fixed that when editing an ingredient with "Only check if a single unit is in stock" set, the quantity unit was always set to the products stock quantity unit regardless if a different one was selected for that ingredient - Fixed a PHP notice on the recipes page when there are no recipes (thanks @mrunkel) ### Calendar fixes diff --git a/public/viewjs/recipeposform.js b/public/viewjs/recipeposform.js index 46a3a1a6..55e559ab 100644 --- a/public/viewjs/recipeposform.js +++ b/public/viewjs/recipeposform.js @@ -79,7 +79,10 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e) $("#not_check_stock_fulfillment").prop("checked", productDetails.product.not_check_stock_fulfillment_for_recipes == 1); - Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id); + if (!$("#only_check_single_unit_in_stock").prop("checked")) + { + Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.quantity_unit_stock.id); + } $('#display_amount').focus(); Grocy.FrontendHelpers.ValidateForm('recipe-pos-form');