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
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 3 additions and 1 deletions

View File

@ -41,6 +41,7 @@
- Added a new entry "Add to meal plan" in the context/more menu per recipe to directly add a recipe to the meal plan from the recipes page
- Changed that when a ingredient has a "Variable amount" set, the text entered there now also replaces the unit when displaying the recipe (not only the amount as before)
- When displaying a recipe in fullscreen mode, the ingredients and preparation is now shown side by side (or below each other on small screens) instead of in tabs
- When consuming a recipe which has a "Produces product" set and when the product's "Default stock entry label" is configured accordingly, the corresponding label will now be printed on that action (only server side label printer WebHooks are supported)
- Fixed that hiding the "Requirements fulfilled" column (table options) on the recipes page didn't work
- Fixed that ingredient costs and calories were wrong when product substitution and unit conversions were involved at the same time

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);
}
}