From 1a82d0599ca6a19d7ca59bb09f90bcb614ee54e2 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 5 Mar 2022 09:03:57 +0100 Subject: [PATCH] Use child product substitution on consuming during chore execution (fixes #1807) --- changelog/67_UNRELEASED_xxxx-xx-xx.md | 1 + services/ChoresService.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog/67_UNRELEASED_xxxx-xx-xx.md b/changelog/67_UNRELEASED_xxxx-xx-xx.md index 0c8d5fc9..cec3c101 100644 --- a/changelog/67_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/67_UNRELEASED_xxxx-xx-xx.md @@ -29,6 +29,7 @@ - The `Daily` period type has been changed to schedule the chore at the _same time_ (based on the start date) each `n` days - This period type scheduled chores `n` days _after the last execution_ before, which is also possible by using the `Hourly` period type and a corresponding period interval; all existing `Daily` schedules will be converted to that on migration +- Fixed that when consuming a parent product on chore execution (chore option "Consume product on chore execution"), no child products were used if the parent product itself is not in-stock ### Calendar diff --git a/services/ChoresService.php b/services/ChoresService.php index bbff0aea..58cf0d8f 100644 --- a/services/ChoresService.php +++ b/services/ChoresService.php @@ -203,7 +203,8 @@ class ChoresService extends BaseService if ($chore->consume_product_on_execution == 1 && !empty($chore->product_id)) { - $this->getStockService()->ConsumeProduct($chore->product_id, $chore->product_amount, false, StockService::TRANSACTION_TYPE_CONSUME); + $transactionId = uniqid(); + $this->getStockService()->ConsumeProduct($chore->product_id, $chore->product_amount, false, StockService::TRANSACTION_TYPE_CONSUME, 'default', null, null, $transactionId, true); } return $lastInsertId;