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

@@ -121,7 +121,13 @@ class StockApiController extends BaseApiController
$specificStockEntryId = $requestBody['stock_entry_id'];
}
$bookingId = $this->StockService->ConsumeProduct($args['productId'], $requestBody['amount'], $spoiled, $transactionType, $specificStockEntryId);
$recipeId = null;
if (array_key_exists('recipe_id', $requestBody) && is_numeric($requestBody['recipe_id']))
{
$recipeId = $requestBody['recipe_id'];
}
$bookingId = $this->StockService->ConsumeProduct($args['productId'], $requestBody['amount'], $spoiled, $transactionType, $specificStockEntryId, $recipeId);
return $this->ApiResponse(array('booking_id' => $bookingId));
}
catch (\Exception $ex)