diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index f839a295..bf4a5d78 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -33,6 +33,8 @@ - The product picker on the consume and transfer page now only shows products which are currently in stock - Added a filter option to only show in-stock products on the stock overview and products list page (master data) - Added new columns on the stock overview page (hidden by default): Product description, product default location, parent product +- Added a new product option "Should not be frozen" (defaults to disabled and only visible when `FEATURE_FLAG_STOCK_PRODUCT_FREEZING` is enabled) + - When enabled, on moving the product to a freezer location (so when freezing it), a corresponding warning will be shown - Optimized that when opening a product which has "Default due days after opened" set, the resulting date now never extends the original due date - Fixed that editing stock entries was not possible - Fixed that consuming with Scan Mode was not possible diff --git a/localization/strings.pot b/localization/strings.pot index 1e02e7c3..e8bb3805 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -2172,3 +2172,12 @@ msgstr "" msgid "Timestamp" msgstr "" + +msgid "Should not be frozen" +msgstr "" + +msgid "When enabled, on moving this product to a freezer location (so when freezing it), a warning will be shown" +msgstr "" + +msgid "This product shouldn't be frozen" +msgstr "" diff --git a/migrations/0146.sql b/migrations/0146.sql new file mode 100644 index 00000000..717b77a3 --- /dev/null +++ b/migrations/0146.sql @@ -0,0 +1,2 @@ +ALTER TABLE products +ADD should_not_be_frozen TINYINT NOT NULL DEFAULT 0 CHECK(should_not_be_frozen IN (0, 1)); diff --git a/public/viewjs/transfer.js b/public/viewjs/transfer.js index d30ee90f..d0140a27 100644 --- a/public/viewjs/transfer.js +++ b/public/viewjs/transfer.js @@ -78,6 +78,11 @@ if (parseInt($("#location_id_from option:selected").attr("data-is-freezer")) === 0 && parseInt($("#location_id_to option:selected").attr("data-is-freezer")) === 1) // Frozen { toastr.info('' + __t("Frozen") + " "); + + if (BoolVal(productDetails.product.should_not_be_frozen)) + { + toastr.warning(__t("This product shouldn't be frozen")); + } } if (parseInt($("#location_id_from option:selected").attr("data-is-freezer")) === 1 && parseInt($("#location_id_to option:selected").attr("data-is-freezer")) === 0) // Thawed { diff --git a/views/productform.blade.php b/views/productform.blade.php index 8e07638a..e08ffefc 100644 --- a/views/productform.blade.php +++ b/views/productform.blade.php @@ -231,6 +231,50 @@ value="1"> @endif + @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_FREEZING) + @php if($mode == 'edit') { $value = $product->default_best_before_days_after_freezing; } else { $value = 0; } @endphp + @include('components.numberpicker', array( + 'id' => 'default_best_before_days_after_freezing', + 'label' => 'Default due days after freezing', + 'min' => -1, + 'value' => $value, + 'hint' => $__t('On moving this product to a freezer location (so when freezing it), the due date will be replaced by today + this amount of days') . ' (' . $__t('-1 means that this product will be never overdue') . ')' + )) + + @php if($mode == 'edit') { $value = $product->default_best_before_days_after_thawing; } else { $value = 0; } @endphp + @include('components.numberpicker', array( + 'id' => 'default_best_before_days_after_thawing', + 'label' => 'Default due days after thawing', + 'min' => 0, + 'value' => $value, + 'hint' => $__t('On moving this product from a freezer location (so when thawing it), the due date will be replaced by today + this amount of days') + )) + +
+
+ should_not_be_frozen == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="should_not_be_frozen" name="should_not_be_frozen" value="1"> + +
+
+ @else + + + + @endif +
- - @endif - @php if($mode == 'edit') { $value = $product->quick_consume_amount; } else { $value = 1; } @endphp @include('components.numberpicker', array( 'id' => 'quick_consume_amount',