mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
Add recipe ingredient notes to the corresponding shopping list item (closes #1397)
This commit is contained in:
parent
1ead23cb87
commit
633b26bf7e
@ -52,6 +52,7 @@
|
||||
### Recipe improvements/fixes
|
||||
- Recipe printing improvements (thanks @Ape)
|
||||
- Calories are now always displayed per single serving (on the recipe and meal plan page)
|
||||
- The note of an ingredient will now also be added to the corresponding shopping list item when using "Put missing products on the shopping list"
|
||||
- Fixed that "Only check if any amount is in stock" (recipe ingredient option) didn't work for stock amounts < 1
|
||||
- Fixed that when adding missing items to the shopping list, on the popup deselected items got also added
|
||||
- Fixed that the amount of self produced products with tare weight handling enabled was wrong ("Produces product" recipe option)
|
||||
|
@ -15,7 +15,6 @@ class RecipesService extends BaseService
|
||||
public function AddNotFulfilledProductsToShoppingList($recipeId, $excludedProductIds = null)
|
||||
{
|
||||
$recipe = $this->getDataBase()->recipes($recipeId);
|
||||
|
||||
$recipePositions = $this->GetRecipesPosResolved();
|
||||
|
||||
foreach ($recipePositions as $recipePosition)
|
||||
@ -23,7 +22,6 @@ class RecipesService extends BaseService
|
||||
if ($recipePosition->recipe_id == $recipeId && !in_array($recipePosition->product_id, $excludedProductIds))
|
||||
{
|
||||
$product = $this->getDataBase()->products($recipePosition->product_id);
|
||||
|
||||
$toOrderAmount = round(($recipePosition->missing_amount - $recipePosition->amount_on_shopping_list), 2);
|
||||
|
||||
if ($recipe->not_check_shoppinglist == 1)
|
||||
@ -33,10 +31,16 @@ class RecipesService extends BaseService
|
||||
|
||||
if ($toOrderAmount > 0)
|
||||
{
|
||||
$note = $this->getLocalizationService()->__t('Added for recipe %s', $recipe->name);
|
||||
if (!empty($recipePosition->note))
|
||||
{
|
||||
$note .= "\n" . $recipePosition->note;
|
||||
}
|
||||
|
||||
$shoppinglistRow = $this->getDataBase()->shopping_list()->createRow([
|
||||
'product_id' => $recipePosition->product_id,
|
||||
'amount' => $toOrderAmount,
|
||||
'note' => $this->getLocalizationService()->__t('Added for recipe %s', $recipe->name)
|
||||
'note' => $note
|
||||
]);
|
||||
$shoppinglistRow->save();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user