Print stock entry labels when consuming a "Produces product" recipe (closes #2123)

This commit is contained in:
Bernd Bestel
2023-02-05 15:24:28 +01:00
parent 9ef5045c9b
commit 0bd698c968
2 changed files with 3 additions and 1 deletions

View File

@@ -104,8 +104,9 @@ class RecipesService extends BaseService
$recipeRow = $this->getDatabase()->recipes()->where('id = :1', $recipeId)->fetch();
if (!empty($recipeRow->product_id))
{
$product = $this->getDatabase()->products()->where('id = :1', $recipeRow->product_id)->fetch();
$recipeResolvedRow = $this->getDatabase()->recipes_resolved()->where('recipe_id = :1', $recipeId)->fetch();
$this->getStockService()->AddProduct($recipeRow->product_id, floatval($recipeRow->desired_servings), null, StockService::TRANSACTION_TYPE_SELF_PRODUCTION, date('Y-m-d'), floatval($recipeResolvedRow->costs_per_serving), null, null, $dummyTransactionId, 0, true);
$this->getStockService()->AddProduct($recipeRow->product_id, floatval($recipeRow->desired_servings), null, StockService::TRANSACTION_TYPE_SELF_PRODUCTION, date('Y-m-d'), floatval($recipeResolvedRow->costs_per_serving), null, null, $dummyTransactionId, $product->default_stock_label_type, true);
}
}