Restore the original due date when undoing a product opened transaction (fixes #1659)

This commit is contained in:
Bernd Bestel 2021-11-12 18:12:34 +01:00
parent f2bef554a4
commit 4338ccc132
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@
- Fixed that the labels of context-/more-menu items were not readable in Night Mode (thanks @corbolais)
- Fixed that auto night mode over midnight did not always work
- Fixed that the "Add as new product" productpicker workflow, started from the shopping list item form, always selected the default shopping list after finishing the flow
- Fixed that when undoing a product opened transaction and when the product has "Default due days after opened", the original due date wasn't restored
- Fixed that "Track date only"-chores were shown as overdue on the due day on the chores overview page
### API

View File

@ -1426,7 +1426,8 @@ class StockService extends BaseService
$stockRows = $this->getDatabase()->stock()->where('stock_id = :1 AND amount = :2 AND purchased_date = :3', $logRow->stock_id, $logRow->amount, $logRow->purchased_date)->limit(1);
$stockRows->update([
'open' => 0,
'opened_date' => null
'opened_date' => null,
'best_before_date' => $logRow->best_before_date // Is only relevant when the product has "Default due days after opened", but also doesn't hurt for other products
]);
// Update log entry