mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Never extend the original due date on when opening a product which has default_best_before_days (closes #1342)
This commit is contained in:
parent
866d6647d2
commit
247221950d
@ -33,6 +33,7 @@
|
||||
- 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 products list page (master data)
|
||||
- Added new columns on the stock overview page (hidden by default): Product description, product default location, parent product
|
||||
- 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
|
||||
- Fixed that the current stock total value (header of the stock overview page) didn't include decimal amounts (thanks @Ape)
|
||||
|
@ -1903,7 +1903,7 @@ msgstr ""
|
||||
msgid "Default due days"
|
||||
msgstr ""
|
||||
|
||||
msgid "When this product was marked as opened, the due date will be replaced by today + this amount of days (a value of 0 disables this)"
|
||||
msgid "When this product was marked as opened, the due date will be replaced by today + this amount of days, but only if the resulting date is not after the original due date (a value of 0 disables this)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Default due days after opened"
|
||||
|
@ -891,6 +891,12 @@ class StockService extends BaseService
|
||||
if ($product->default_best_before_days_after_open > 0)
|
||||
{
|
||||
$newBestBeforeDate = date('Y-m-d', strtotime('+' . $product->default_best_before_days_after_open . ' days'));
|
||||
|
||||
// The new due date should be never > the original due date
|
||||
if (strtotime($newBestBeforeDate) > strtotime($stockEntry->best_before_date))
|
||||
{
|
||||
$newBestBeforeDate = $stockEntry->best_before_date;
|
||||
}
|
||||
}
|
||||
|
||||
if ($allowSubproductSubstitution && $stockEntry->product_id != $productId)
|
||||
|
@ -212,7 +212,7 @@
|
||||
'label' => 'Default due days after opened',
|
||||
'min' => 0,
|
||||
'value' => $value,
|
||||
'hint' => $__t('When this product was marked as opened, the due date will be replaced by today + this amount of days (a value of 0 disables this)')
|
||||
'hint' => $__t('When this product was marked as opened, the due date will be replaced by today + this amount of days, but only if the resulting date is not after the original due date (a value of 0 disables this)')
|
||||
))
|
||||
@else
|
||||
<input type="hidden"
|
||||
|
Loading…
x
Reference in New Issue
Block a user