diff --git a/changelog/56_UNRELEASED_2020-xx-xx.md b/changelog/56_UNRELEASED_2020-xx-xx.md
index 6cac93f3..cdac20e7 100644
--- a/changelog/56_UNRELEASED_2020-xx-xx.md
+++ b/changelog/56_UNRELEASED_2020-xx-xx.md
@@ -4,6 +4,7 @@
### Shopping list improvements/fixes
- Added an option to hide the month-calendar (in the shopping list settings / top right corner settings menu) (defaults to disabled, so please enable this option if you still want to have the month-calendar on the shopping list)
- Optimized the new compact view (there was a little too much white space at the sides of the page)
+- Fixed that the "Shopping list to stock workflow" did not work when `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING` was set to `false`
### Recipe improvements/fixes
- Optimized the ordering of the inputs on the recipe ingredient edit page (moved "Only check if a single unit is in stock" before the amount)
diff --git a/public/js/extensions.js b/public/js/extensions.js
index 60087bb9..e8f5b1c8 100644
--- a/public/js/extensions.js
+++ b/public/js/extensions.js
@@ -163,7 +163,7 @@ function animateCSS(selector, animationName, callback, speed = "faster")
{
nodes.removeClass('animated').removeClass(speed).removeClass(animationName);
nodes.unbind('animationend', handleAnimationEnd);
-
+
if (typeof callback === 'function')
{
callback();
diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js
index c035c054..a5918903 100644
--- a/public/viewjs/purchase.js
+++ b/public/viewjs/purchase.js
@@ -178,6 +178,11 @@ if (Grocy.Components.ProductPicker !== undefined)
$("#tare-weight-handling-info").addClass("d-none");
}
+ if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
+ {
+ Grocy.Components.DateTimePicker.SetValue(moment().format('YYYY-MM-DD'));
+ }
+
if (productDetails.product.default_best_before_days.toString() !== '0')
{
if (productDetails.product.default_best_before_days == -1)
@@ -192,12 +197,6 @@ if (Grocy.Components.ProductPicker !== undefined)
Grocy.Components.DateTimePicker.SetValue(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD'));
}
$('#amount').focus();
-
- Grocy.FrontendHelpers.ValidateForm('purchase-form');
- if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && document.getElementById("purchase-form").checkValidity() === true)
- {
- $("#save-purchase-button").click();
- }
}
else
{
@@ -207,11 +206,16 @@ if (Grocy.Components.ProductPicker !== undefined)
}
else
{
- Grocy.Components.DateTimePicker.SetValue(moment().format('YYYY-MM-DD'));
$('#amount').focus();
}
}
+ Grocy.FrontendHelpers.ValidateForm('purchase-form');
+ if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && document.getElementById("purchase-form").checkValidity() === true)
+ {
+ $("#save-purchase-button").click();
+ }
+
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
{
$("#amount").val(1);
diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js
index b0d7c742..2a7cc52a 100644
--- a/public/viewjs/shoppinglist.js
+++ b/public/viewjs/shoppinglist.js
@@ -95,7 +95,7 @@ $(document).on('click', '.shoppinglist-delete-button', function(e)
var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id');
Grocy.FrontendHelpers.BeginUiBusy();
- Grocy.Api.Delete('objects/shopping_list/' + shoppingListItemId, {},
+ Grocy.Api.Delete('objects/shopping_list/' + shoppingListItemId, { },
function(result)
{
animateCSS("#shoppinglistitem-" + shoppingListItemId + "-row", "fadeOut", function()
diff --git a/views/barcodescannertesting.blade.php b/views/barcodescannertesting.blade.php
index 873aed42..5c1647df 100644
--- a/views/barcodescannertesting.blade.php
+++ b/views/barcodescannertesting.blade.php
@@ -5,7 +5,7 @@
@section('viewJsName', 'barcodescannertesting')
@push('pageScripts')
-
+
@endpush
@section('content')
diff --git a/views/batteriesoverview.blade.php b/views/batteriesoverview.blade.php
index 21ee0b05..4140eff0 100644
--- a/views/batteriesoverview.blade.php
+++ b/views/batteriesoverview.blade.php
@@ -5,7 +5,7 @@
@section('viewJsName', 'batteriesoverview')
@push('pageStyles')
-
+
@endpush
@section('content')
diff --git a/views/choresoverview.blade.php b/views/choresoverview.blade.php
index ebd0a01a..2b10a3f9 100644
--- a/views/choresoverview.blade.php
+++ b/views/choresoverview.blade.php
@@ -5,7 +5,7 @@
@section('viewJsName', 'choresoverview')
@push('pageStyles')
-
+
@endpush
@section('content')
diff --git a/views/manageapikeys.blade.php b/views/manageapikeys.blade.php
index 945be54f..28e6bd72 100644
--- a/views/manageapikeys.blade.php
+++ b/views/manageapikeys.blade.php
@@ -5,7 +5,7 @@
@section('viewJsName', 'manageapikeys')
@push('pageStyles')
-
+
@endpush
@section('content')
diff --git a/views/quantityunitpluraltesting.blade.php b/views/quantityunitpluraltesting.blade.php
index 68db34a6..645c5f6f 100644
--- a/views/quantityunitpluraltesting.blade.php
+++ b/views/quantityunitpluraltesting.blade.php
@@ -5,7 +5,7 @@
@section('viewJsName', 'quantityunitpluraltesting')
@push('pageStyles')
-
+
@endpush
@section('content')
diff --git a/views/shoppinglist.blade.php b/views/shoppinglist.blade.php
index a9a872e1..e0dcb905 100644
--- a/views/shoppinglist.blade.php
+++ b/views/shoppinglist.blade.php
@@ -11,7 +11,7 @@
@endpush
@push('pageStyles')
-
+
@endpush
diff --git a/views/stockentries.blade.php b/views/stockentries.blade.php
index f2ef885c..7b6566fb 100644
--- a/views/stockentries.blade.php
+++ b/views/stockentries.blade.php
@@ -4,7 +4,7 @@
@section('viewJsName', 'stockentries')
@push('pageStyles')
-
+
@endpush
@push('pageScripts')
diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php
index e5b0d559..46e189ec 100644
--- a/views/stockoverview.blade.php
+++ b/views/stockoverview.blade.php
@@ -5,7 +5,7 @@
@section('viewJsName', 'stockoverview')
@push('pageStyles')
-
+
@endpush
@push('pageScripts')
diff --git a/views/tasks.blade.php b/views/tasks.blade.php
index ac6cd8aa..4f712312 100644
--- a/views/tasks.blade.php
+++ b/views/tasks.blade.php
@@ -10,7 +10,7 @@
@endpush
@push('pageStyles')
-
+
@endpush