From c0c9a38e396aaf437d923f288c3325b54f679a7d Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 29 Mar 2026 15:27:40 +0200 Subject: [PATCH] Fixed shopping_location_id was missing for consume / transfer stock transactions and when undoing them (fixes #2896) --- changelog/82_UNRELEASED_xxxx-xx-xx.md | 2 ++ services/StockService.php | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/changelog/82_UNRELEASED_xxxx-xx-xx.md b/changelog/82_UNRELEASED_xxxx-xx-xx.md index f395e510..0c3b4538 100644 --- a/changelog/82_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/82_UNRELEASED_xxxx-xx-xx.md @@ -11,6 +11,8 @@ ### Stock - Fixed that changing the location on the purchase page re-initialized the due date based on product defaults (if any) +- Fixed that when undoing a product consume or transfer transaction, the store of the corresponding stock entry wasn't restored + - This will only apply to new consume / transfer transactions, not when undoing transactions made before using this release ### Shopping list diff --git a/services/StockService.php b/services/StockService.php index da27dacc..26efe99e 100644 --- a/services/StockService.php +++ b/services/StockService.php @@ -463,7 +463,8 @@ class StockService extends BaseService 'transaction_id' => $transactionId, 'user_id' => GROCY_USER_ID, 'location_id' => $stockEntry->location_id, - 'note' => $stockEntry->note + 'note' => $stockEntry->note, + 'shopping_location_id' => $stockEntry->shopping_location_id ]); $logRow->save(); @@ -498,7 +499,8 @@ class StockService extends BaseService 'transaction_id' => $transactionId, 'user_id' => GROCY_USER_ID, 'location_id' => $stockEntry->location_id, - 'note' => $stockEntry->note + 'note' => $stockEntry->note, + 'shopping_location_id' => $stockEntry->shopping_location_id ]); $logRow->save(); @@ -1532,7 +1534,8 @@ class StockService extends BaseService 'opened_date' => $logRow->opened_date, 'open' => $logRow->opened_date !== null, 'location_id' => $logRow->location_id, - 'note' => $logRow->note + 'note' => $logRow->note, + 'shopping_location_id' => $logRow->shopping_location_id ]); $stockRow->save(); @@ -1583,7 +1586,8 @@ class StockService extends BaseService 'stock_id' => $logRow->stock_id, 'price' => $logRow->price, 'opened_date' => $logRow->opened_date, - 'note' => $logRow->note + 'note' => $logRow->note, + 'shopping_location_id' => $logRow->shopping_location_id ]); $stockRow->save(); }