Fixed new user settings naming

This commit is contained in:
Bernd Bestel 2022-04-07 19:25:27 +02:00
parent e0c72c05c2
commit 632db0d8d1
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
5 changed files with 18 additions and 16 deletions

View File

@ -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

View File

@ -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", "");
}
});

View File

@ -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;

View File

@ -102,11 +102,13 @@
href="#">
{{ $__t('Add all list items to stock') }}
</a>
@if(!boolval($userSettings['shopping_list_auto_add_below_min_stock_amount']))
<a id="add-products-below-min-stock-amount"
class="btn btn-outline-primary btn-sm mb-1 responsive-button @if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif"
href="#">
{{ $__t('Add products that are below defined min. stock amount') }}
</a>
@endif
<a id="add-overdue-expired-products"
class="btn btn-outline-primary btn-sm mb-1 responsive-button @if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif"
href="#">

View File

@ -31,15 +31,15 @@
<div class="custom-control custom-checkbox">
<input type="checkbox"
class="form-check-input custom-control-input user-setting-control"
id="stock_auto_add_below_min_stock_amount_to_shopping_list"
data-setting-key="stock_auto_add_below_min_stock_amount_to_shopping_list">
id="shopping_list_auto_add_below_min_stock_amount"
data-setting-key="shopping_list_auto_add_below_min_stock_amount">
<label class="form-check-label custom-control-label"
for="stock_auto_add_below_min_stock_amount_to_shopping_list">
for="shopping_list_auto_add_below_min_stock_amount">
{{ $__t('Automatically add products that are below their defined min. stock amount to the shopping list') }}
<select class="custom-control custom-select user-setting-control"
id="stock_auto_add_below_min_stock_amount_to_shopping_list_id"
data-setting-key="stock_auto_add_below_min_stock_amount_to_shopping_list_id"
@if(!boolval($userSettings['stock_auto_add_below_min_stock_amount_to_shopping_list']))
id="shopping_list_auto_add_below_min_stock_amount_list_id"
data-setting-key="shopping_list_auto_add_below_min_stock_amount_list_id"
@if(!boolval($userSettings['shopping_list_auto_add_below_min_stock_amount']))
disabled
@endif>
@foreach($shoppingLists as $shoppingList)