mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Support -1 for "Default due days after freezing" (closes #846)
This commit is contained in:
parent
362b3f8508
commit
250b308d5d
@ -69,6 +69,7 @@
|
||||
- Added more filters on the stock journal page
|
||||
- Added a grouped/summarized stock journal (new button "Journal summary" at the top of the stock journal page) (thanks @fipwmaqzufheoxq92ebc)
|
||||
- Provides an overview of summarized transactions per product, transaction type and user + summarized amount
|
||||
- The product option "Default due days after freezing" now also supports `-1` (like the option "Default due days") to set the product to "never due" on freezing
|
||||
- Fixed that changing the products "Factor purchase to stock quantity unit" not longer messes up historical prices (which results for example in wrong recipe costs) (thanks @kriddles)
|
||||
- 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)
|
||||
|
@ -1005,9 +1005,16 @@ class StockService extends BaseService
|
||||
$locationTo = $this->getDatabase()->locations()->where('id', $locationIdTo)->fetch();
|
||||
|
||||
// Product was moved from a non-freezer to freezer location -> freeze
|
||||
if (intval($locationFrom->is_freezer) === 0 && intval($locationTo->is_freezer) === 1 && $productDetails->product->default_best_before_days_after_freezing > 0)
|
||||
if (intval($locationFrom->is_freezer) === 0 && intval($locationTo->is_freezer) === 1 && $productDetails->product->default_best_before_days_after_freezing >= -1)
|
||||
{
|
||||
$newBestBeforeDate = date('Y-m-d', strtotime('+' . $productDetails->product->default_best_before_days_after_freezing . ' days'));
|
||||
if ($productDetails->product->default_best_before_days_after_freezing == -1)
|
||||
{
|
||||
$newBestBeforeDate = date('2999-12-31');
|
||||
}
|
||||
else
|
||||
{
|
||||
$newBestBeforeDate = date('Y-m-d', strtotime('+' . $productDetails->product->default_best_before_days_after_freezing . ' days'));
|
||||
}
|
||||
}
|
||||
|
||||
// Product was moved from a freezer to non-freezer location -> thaw
|
||||
|
@ -376,14 +376,14 @@
|
||||
'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')
|
||||
'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' => -1,
|
||||
'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')
|
||||
))
|
||||
|
Loading…
x
Reference in New Issue
Block a user