Consume any subproduct when consuming a recipe ingredient which is not in stock (fixes #446)

This commit is contained in:
Bernd Bestel
2020-01-27 22:14:11 +01:00
parent dceed6759a
commit e84c7063d3
6 changed files with 41 additions and 20 deletions

View File

@@ -567,7 +567,13 @@ class StockApiController extends BaseApiController
public function ProductStockEntries(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
{
return $this->ApiResponse($this->StockService->GetProductStockEntries($args['productId']));
$allowSubproductSubstitution = false;
if (isset($request->getQueryParams()['include_sub_products']) && boolval($request->getQueryParams()['include_sub_products']))
{
$allowSubproductSubstitution = true;
}
return $this->ApiResponse($this->StockService->GetProductStockEntries($args['productId'], false, $allowSubproductSubstitution));
}
public function ProductStockLocations(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)