Track on consume for which recipe it was (closes #64 and references #64)

This commit is contained in:
Bernd Bestel
2019-03-03 18:20:06 +01:00
parent 38825c70da
commit 8020f92d6b
13 changed files with 127 additions and 7 deletions

View File

@@ -68,7 +68,7 @@ class RecipesService extends BaseService
{
if ($recipePosition->only_check_single_unit_in_stock == 0)
{
$this->StockService->ConsumeProduct($recipePosition->product_id, $recipePosition->amount, false, StockService::TRANSACTION_TYPE_CONSUME);
$this->StockService->ConsumeProduct($recipePosition->product_id, $recipePosition->amount, false, StockService::TRANSACTION_TYPE_CONSUME, 'default', $recipeId);
}
}
}

View File

@@ -165,7 +165,7 @@ class StockService extends BaseService
}
}
public function ConsumeProduct(int $productId, float $amount, bool $spoiled, $transactionType, $specificStockEntryId = 'default')
public function ConsumeProduct(int $productId, float $amount, bool $spoiled, $transactionType, $specificStockEntryId = 'default', $recipeId = null)
{
if (!$this->ProductExists($productId))
{
@@ -206,7 +206,8 @@ class StockService extends BaseService
'stock_id' => $stockEntry->stock_id,
'transaction_type' => $transactionType,
'price' => $stockEntry->price,
'opened_date' => $stockEntry->opened_date
'opened_date' => $stockEntry->opened_date,
'recipe_id' => $recipeId
));
$logRow->save();
@@ -228,7 +229,8 @@ class StockService extends BaseService
'stock_id' => $stockEntry->stock_id,
'transaction_type' => $transactionType,
'price' => $stockEntry->price,
'opened_date' => $stockEntry->opened_date
'opened_date' => $stockEntry->opened_date,
'recipe_id' => $recipeId
));
$logRow->save();