mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 19:37:12 +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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user