diff --git a/changelog/60_UNRELEASED_2020-xx-xx.md b/changelog/60_UNRELEASED_2020-xx-xx.md index 5cdc1f8e..de3fe86b 100644 --- a/changelog/60_UNRELEASED_2020-xx-xx.md +++ b/changelog/60_UNRELEASED_2020-xx-xx.md @@ -32,6 +32,7 @@ - Product edit page improvements ("Save & continue" button, deleting and adding a product picuture is now possible in one go) (thanks @Ma27) - For products with tare weight handling enabled, it's now optionally possible to consume a fixed/exact amount (just like for "normal" products) in case you don't want to weigh the whole container this time (new checkbox on the consume page) (thanks @fipwmaqzufheoxq92ebc) - The stock overview page now also shows the value - new column and also the total value in the header (thanks @kriddles) +- It's now possible to set a custom purchased date on purchase (new field on the purchase page, hidden by default - enable it by a new stock setting (top right corner settings menu)) (thanks @kriddles) - Fixed that it was not possible to leave the "Barcode(s)" on the product edit page by `TAB` - Fixed that when adding products through a product picker workflow and when the created products contains special characters, the product was not preselected on the previous page (thanks @Forceu) - Fixed that when editing a product the default store was not visible / always empty regardless if the product had one set (thanks @kriddles) diff --git a/config-dist.php b/config-dist.php index 6a4f262e..972558c4 100644 --- a/config-dist.php +++ b/config-dist.php @@ -1,110 +1,108 @@ BASE_PATH = /grocy +// When running grocy in a subdirectory, this should be set to the relative path, otherwise empty +// Example: +// Webserver root directory = /var/www +// grocy directory = /var/www/grocy +// => BASE_PATH = /grocy Setting('BASE_PATH', ''); -# The base url of your installation, -# should be just "/" when running directly under the root of a (sub)domain -# or for example "https://example.com/grocy" when using a subdirectory +// The base url of your installation, +// should be just "/" when running directly under the root of a (sub)domain +// or for example "https://example.com/grocy" when using a subdirectory Setting('BASE_URL', '/'); -# The plugin to use for external barcode lookups, -# must be the filename without .php extension and must be located in /data/plugins, -# see /data/plugins/DemoBarcodeLookupPlugin.php for an example implementation +// The plugin to use for external barcode lookups, +// must be the filename without .php extension and must be located in /data/plugins, +// see /data/plugins/DemoBarcodeLookupPlugin.php for an example implementation Setting('STOCK_BARCODE_LOOKUP_PLUGIN', 'DemoBarcodeLookupPlugin'); -# If, however, your webserver does not support URL rewriting, set this to true +// If, however, your webserver does not support URL rewriting, set this to true Setting('DISABLE_URL_REWRITING', false); -# Specify an custom homepage if desired - by default the homepage will be set to the stock overview, -# this needs to be one of the following values: -# stock, shoppinglist, recipes, chores, tasks, batteries, equipment, calendar, mealplan +// Specify an custom homepage if desired - by default the homepage will be set to the stock overview, +// this needs to be one of the following values: +// stock, shoppinglist, recipes, chores, tasks, batteries, equipment, calendar, mealplan Setting('ENTRY_PAGE', 'stock'); -# Set this to true if you want to disable authentication / the login screen, -# places where user context is needed will then use the default (first existing) user +// Set this to true if you want to disable authentication / the login screen, +// places where user context is needed will then use the default (first existing) user Setting('DISABLE_AUTH', false); -# Either "Grocy\Middleware\DefaultAuthMiddleware", "Grocy\Middleware\ReverseProxyAuthMiddleware" -# or any class that implements Grocy\Middleware\AuthMiddleware +// Either "Grocy\Middleware\DefaultAuthMiddleware", "Grocy\Middleware\ReverseProxyAuthMiddleware" +// or any class that implements Grocy\Middleware\AuthMiddleware Setting('AUTH_CLASS', 'Grocy\Middleware\DefaultAuthMiddleware'); -# When using ReverseProxyAuthMiddleware, -# the name of the HTTP header which your reverse proxy uses to pass the username (on successful authentication) +// When using ReverseProxyAuthMiddleware, +// the name of the HTTP header which your reverse proxy uses to pass the username (on successful authentication) Setting('REVERSE_PROXY_AUTH_HEADER', 'REMOTE_USER'); -# Set this to true if you want to disable the ability to scan a barcode via the device camera (Browser API) +// Set this to true if you want to disable the ability to scan a barcode via the device camera (Browser API) Setting('DISABLE_BROWSER_BARCODE_CAMERA_SCANNING', false); -# Set this if you want to have a different start day for the weekly meal plan view, -# leave empty to use CALENDAR_FIRST_DAY_OF_WEEK (see above) -# Needs to be a number where Sunday = 0, Monday = 1 and so forth +// Set this if you want to have a different start day for the weekly meal plan view, +// leave empty to use CALENDAR_FIRST_DAY_OF_WEEK (see above) +// Needs to be a number where Sunday = 0, Monday = 1 and so forth Setting('MEAL_PLAN_FIRST_DAY_OF_WEEK', ''); -# Default permissions for new users -# the array needs to contain the technical/constant names -# see the file controllers/Users/User.php for possible values +// Default permissions for new users +// the array needs to contain the technical/constant names +// see the file controllers/Users/User.php for possible values Setting('DEFAULT_PERMISSIONS', ['ADMIN']); +// Default user settings +// These settings can be changed per user, here the defaults +// are defined which are used when the user has not changed the setting so far -# Default user settings -# These settings can be changed per user, here the defaults -# are defined which are used when the user has not changed the setting so far - -# Night mode related +// Night mode related DefaultUserSetting('night_mode_enabled', false); // If night mode is enabled always DefaultUserSetting('auto_night_mode_enabled', false); // If night mode is enabled automatically when inside a given time range (see the two settings below) -DefaultUserSetting('auto_night_mode_time_range_from', "20:00"); // Format HH:mm -DefaultUserSetting('auto_night_mode_time_range_to', "07:00"); // Format HH:mm +DefaultUserSetting('auto_night_mode_time_range_from', '20:00'); // Format HH:mm +DefaultUserSetting('auto_night_mode_time_range_to', '07:00'); // Format HH:mm DefaultUserSetting('auto_night_mode_time_range_goes_over_midnight', true); // If the time range above goes over midnight DefaultUserSetting('currently_inside_night_mode_range', false); // If we're currently inside of night mode time range (this is not user configurable, but stored as a user setting because it's evaluated client side to be able to use the client time instead of the maybe different server time) -# Keep screen on settings +// Keep screen on settings DefaultUserSetting('keep_screen_on', false); // Keep the screen always on DefaultUserSetting('keep_screen_on_when_fullscreen_card', false); // Keep the screen on when a "fullscreen-card" is displayed -# Stock settings +// Stock settings DefaultUserSetting('product_presets_location_id', -1); // Default location id for new products (-1 means no location is preset) DefaultUserSetting('product_presets_product_group_id', -1); // Default product group id for new products (-1 means no product group is preset) DefaultUserSetting('product_presets_qu_id', -1); // Default quantity unit id for new products (-1 means no quantity unit is preset) @@ -114,46 +112,46 @@ DefaultUserSetting('stock_default_consume_amount', 1); DefaultUserSetting('scan_mode_consume_enabled', false); DefaultUserSetting('scan_mode_purchase_enabled', false); DefaultUserSetting('show_icon_on_stock_overview_page_when_product_is_on_shopping_list', true); -DefaultUserSetting('product_display_purchased_date', false); +DefaultUserSetting('show_purchased_date_on_purchase', false); // Wheter the purchased date should be editable on purchase (defaults to today otherwise) -# Shopping list settings +// 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 best before days" set DefaultUserSetting('shopping_list_show_calendar', false); DefaultUserSetting('shopping_list_disable_auto_compact_view_on_mobile', false); -# Recipe settings +// Recipe settings DefaultUserSetting('recipe_ingredients_group_by_product_group', false); // Group recipe ingredients by their product group -# Chores settings +// Chores settings DefaultUserSetting('chores_due_soon_days', 5); -# Batteries settings +// Batteries settings DefaultUserSetting('batteries_due_soon_days', 5); -# Tasks settings +// Tasks settings DefaultUserSetting('tasks_due_soon_days', 5); -# If the page should be automatically reloaded when there was -# an external change +// If the page should be automatically reloaded when there was +// an external change DefaultUserSetting('auto_reload_on_db_change', true); -# Show a clock in the header next to the logo or not +// Show a clock in the header next to the logo or not DefaultUserSetting('show_clock_in_header', false); -# Component configuration for Quagga2 - read https://github.com/ericblade/quagga2#configobject for details -# Below is a generic good configuration, -# for an iPhone 7 Plus, halfsample = true, patchsize = small, frequency = 5 yields very good results +// Component configuration for Quagga2 - read https://github.com/ericblade/quagga2#configobject for details +// Below is a generic good configuration, +// for an iPhone 7 Plus, halfsample = true, patchsize = small, frequency = 5 yields very good results DefaultUserSetting('quagga2_numofworkers', 4); DefaultUserSetting('quagga2_halfsample', false); DefaultUserSetting('quagga2_patchsize', 'medium'); DefaultUserSetting('quagga2_frequency', 10); DefaultUserSetting('quagga2_debug', true); -# Feature flags -# grocy was initially about "stock management for your household", many other things -# came and still come by, because they are useful - here you can disable the parts -# which you don't need to have a less cluttered UI -# (set the setting to "false" to disable the corresponding part, which should be self explanatory) +// Feature flags +// grocy was initially about "stock management for your household", many other things +// came and still come by, because they are useful - here you can disable the parts +// which you don't need to have a less cluttered UI +// (set the setting to "false" to disable the corresponding part, which should be self explanatory) Setting('FEATURE_FLAG_STOCK', true); Setting('FEATURE_FLAG_SHOPPINGLIST', true); Setting('FEATURE_FLAG_RECIPES', true); @@ -163,8 +161,7 @@ Setting('FEATURE_FLAG_BATTERIES', true); Setting('FEATURE_FLAG_EQUIPMENT', true); Setting('FEATURE_FLAG_CALENDAR', true); - -# Sub feature flags +// Sub feature flags Setting('FEATURE_FLAG_STOCK_PRICE_TRACKING', true); Setting('FEATURE_FLAG_STOCK_LOCATION_TRACKING', true); Setting('FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING', true); @@ -174,7 +171,6 @@ Setting('FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD', true); // Activa Setting('FEATURE_FLAG_SHOPPINGLIST_MULTIPLE_LISTS', true); Setting('FEATURE_FLAG_CHORES_ASSIGNMENTS', true); - -# Feature settings +// Feature settings Setting('FEATURE_SETTING_STOCK_COUNT_OPENED_PRODUCTS_AGAINST_MINIMUM_STOCK_AMOUNT', true); // When set to true opened items will be counted as missing from stock when calculating if a product is below its minimum. Setting('FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA', true); // Enables the torch automaticaly in every camera barcode scanner. diff --git a/localization/strings.pot b/localization/strings.pot index d6819df5..8e876d6a 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -1921,3 +1921,6 @@ msgstr "" msgid "%s total value" msgstr "" + +msgid "Show purchased date on purchase form (otherwise the purchased date defaults to today)" +msgstr "" diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js index afec4015..50f75170 100644 --- a/public/viewjs/purchase.js +++ b/public/viewjs/purchase.js @@ -29,7 +29,12 @@ var jsonData = {}; jsonData.amount = amount; - jsonData.purchased_date = Grocy.Components.DateTimePicker2.GetValue(); + + if (Grocy.UserSettings.show_purchased_date_on_purchase) + { + jsonData.purchased_date = Grocy.Components.DateTimePicker2.GetValue(); + } + if (Grocy.Components.DateTimePicker) { jsonData.best_before_date = Grocy.Components.DateTimePicker.GetValue(); @@ -446,7 +451,7 @@ function refreshPriceHint() if (document.getElementById("amount_qu_unit").getAttribute("qu-factor-purchase-to-stock") > 1) { - $('#price-hint').text(__t('means %1$s per %2$s and %3$s per %4$s', price.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: 2 }), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name"), quprice.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: 2 }),document.getElementById("amount_qu_unit").getAttribute("quantity-unit-purchase-name"))); + $('#price-hint').text(__t('means %1$s per %2$s and %3$s per %4$s', price.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: 2 }), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-stock-name"), quprice.toLocaleString({ minimumFractionDigits: 2, maximumFractionDigits: 2 }), document.getElementById("amount_qu_unit").getAttribute("quantity-unit-purchase-name"))); } else { diff --git a/public/viewjs/stocksettings.js b/public/viewjs/stocksettings.js index 6ee8c7ec..dc069a59 100644 --- a/public/viewjs/stocksettings.js +++ b/public/viewjs/stocksettings.js @@ -9,7 +9,7 @@ if (BoolVal(Grocy.UserSettings.show_icon_on_stock_overview_page_when_product_is_ { $("#show_icon_on_stock_overview_page_when_product_is_on_shopping_list").prop("checked", true); } -if (BoolVal(Grocy.UserSettings.product_display_purchased_date)) +if (BoolVal(Grocy.UserSettings.show_purchased_date_on_purchase)) { - $("#product_display_purchased_date").prop("checked", true); + $("#show_purchased_date_on_purchase").prop("checked", true); } diff --git a/views/purchase.blade.php b/views/purchase.blade.php index 06edbfc5..df6c326a 100644 --- a/views/purchase.blade.php +++ b/views/purchase.blade.php @@ -53,7 +53,7 @@ class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '' )) - @if(boolval($userSettings['product_display_purchased_date'])) + @if(boolval($userSettings['show_purchased_date_on_purchase'])) @include('components.datetimepicker2', array( 'id' => 'purchased_date', 'label' => 'Purchased date', @@ -61,11 +61,9 @@ 'initWithNow' => true, 'limitEndToNow' => false, 'limitStartToNow' => false, - 'invalidFeedback' => $__t('A purchase date is required'), + 'invalidFeedback' => $__t('A purchased date is required'), 'nextInputSelector' => '#best_before_date', 'additionalCssClasses' => 'date-only-datetimepicker2', - 'earlierThanInfoLimit' => date('Y-m-d'), - 'earlierThanInfoText' => $__t('The given date is earlier than today, are you sure?'), 'additionalGroupCssClasses' => $additionalGroupCssClasses, 'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD )) diff --git a/views/stocksettings.blade.php b/views/stocksettings.blade.php index 03604a97..0d07e734 100644 --- a/views/stocksettings.blade.php +++ b/views/stocksettings.blade.php @@ -95,11 +95,11 @@
-