diff --git a/config-dist.php b/config-dist.php index 7cae311a..d5988841 100644 --- a/config-dist.php +++ b/config-dist.php @@ -184,12 +184,12 @@ DefaultUserSetting('scan_mode_purchase_enabled', false); // If scan mode on the DefaultUserSetting('show_icon_on_stock_overview_page_when_product_is_on_shopping_list', true); // When enabled, an icon is shown on the stock overview page (next to the product name) when the prodcut is currently on a shopping list DefaultUserSetting('show_purchased_date_on_purchase', false); // Whether the purchased date should be editable on purchase (defaults to today otherwise) DefaultUserSetting('show_warning_on_purchase_when_due_date_is_earlier_than_next', true); // Show a warning on purchase when the due date of the purchased product is earlier than the next due date in stock -DefaultUserSetting('stock_auto_add_below_min_stock_amount_to_shopping_list', false); // If products should be automatically added to the shopping list when they are below their min. stock amount -DefaultUserSetting('stock_auto_add_below_min_stock_amount_to_shopping_list_id', 1); // When the above setting is enabled, the id of the shopping list to which the products will be added // Shopping list settings DefaultUserSetting('shopping_list_to_stock_workflow_auto_submit_when_prefilled', false); // Automatically do the booking using the last price and the amount of the shopping list item, if the product has "Default due days" set DefaultUserSetting('shopping_list_show_calendar', false); // When enabled, a small (month view) calendar will be shown on the shopping list page +DefaultUserSetting('shopping_list_auto_add_below_min_stock_amount', false); // If products should be automatically added to the shopping list when they are below their min. stock amount +DefaultUserSetting('shopping_list_auto_add_below_min_stock_amount_list_id', 1); // When the above setting is enabled, the id of the shopping list to which the products will be added // Recipe settings DefaultUserSetting('recipe_ingredients_group_by_product_group', false); // Group recipe ingredients by their product group diff --git a/public/viewjs/shoppinglistsettings.js b/public/viewjs/shoppinglistsettings.js index abaecbd9..5ce2e725 100644 --- a/public/viewjs/shoppinglistsettings.js +++ b/public/viewjs/shoppinglistsettings.js @@ -8,22 +8,22 @@ if (BoolVal(Grocy.UserSettings.shopping_list_show_calendar)) $("#shopping_list_show_calendar").prop("checked", true); } -if (BoolVal(Grocy.UserSettings.stock_auto_add_below_min_stock_amount_to_shopping_list)) +if (BoolVal(Grocy.UserSettings.shopping_list_auto_add_below_min_stock_amount)) { - $("#stock_auto_add_below_min_stock_amount_to_shopping_list").prop("checked", true); + $("#shopping_list_auto_add_below_min_stock_amount").prop("checked", true); } -$("#stock_auto_add_below_min_stock_amount_to_shopping_list_id").val(Grocy.UserSettings.stock_auto_add_below_min_stock_amount_to_shopping_list_id); +$("#shopping_list_auto_add_below_min_stock_amount_list_id").val(Grocy.UserSettings.shopping_list_auto_add_below_min_stock_amount_list_id); -$("#stock_auto_add_below_min_stock_amount_to_shopping_list").on("click", function() +$("#shopping_list_auto_add_below_min_stock_amount").on("click", function() { if (this.checked) { - $("#stock_auto_add_below_min_stock_amount_to_shopping_list_id").removeAttr("disabled"); + $("#shopping_list_auto_add_below_min_stock_amount_list_id").removeAttr("disabled"); } else { - $("#stock_auto_add_below_min_stock_amount_to_shopping_list_id").attr("disabled", ""); + $("#shopping_list_auto_add_below_min_stock_amount_list_id").attr("disabled", ""); } }); diff --git a/services/StockService.php b/services/StockService.php index 03136806..6cf09284 100644 --- a/services/StockService.php +++ b/services/StockService.php @@ -495,9 +495,9 @@ class StockService extends BaseService $this->CompactStockEntries($productId); - if (boolval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_auto_add_below_min_stock_amount_to_shopping_list'))) + if (boolval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'shopping_list_auto_add_below_min_stock_amount'))) { - $this->AddMissingProductsToShoppingList(intval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_auto_add_below_min_stock_amount_to_shopping_list_id'))); + $this->AddMissingProductsToShoppingList(intval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'shopping_list_auto_add_below_min_stock_amount_list_id'))); } return $transactionId; diff --git a/views/shoppinglist.blade.php b/views/shoppinglist.blade.php index 87eee4c9..931d3c79 100644 --- a/views/shoppinglist.blade.php +++ b/views/shoppinglist.blade.php @@ -102,11 +102,13 @@ href="#"> {{ $__t('Add all list items to stock') }} + @if(!boolval($userSettings['shopping_list_auto_add_below_min_stock_amount'])) {{ $__t('Add products that are below defined min. stock amount') }} + @endif diff --git a/views/shoppinglistsettings.blade.php b/views/shoppinglistsettings.blade.php index 5f0400c7..eaf84529 100644 --- a/views/shoppinglistsettings.blade.php +++ b/views/shoppinglistsettings.blade.php @@ -31,15 +31,15 @@
+ id="shopping_list_auto_add_below_min_stock_amount" + data-setting-key="shopping_list_auto_add_below_min_stock_amount">