mirror of
https://github.com/grocy/grocy.git
synced 2025-08-17 03:04:36 +00:00
Implemented multiple/named shopping lists (closes #190)
This commit is contained in:
@@ -242,13 +242,29 @@ class StockApiController extends BaseApiController
|
||||
|
||||
public function AddMissingProductsToShoppingList(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
$this->StockService->AddMissingProductsToShoppingList();
|
||||
$requestBody = $request->getParsedBody();
|
||||
|
||||
$listId = 1;
|
||||
if (array_key_exists('list_id', $requestBody) && !empty($requestBody['list_id']) && is_numeric($requestBody['list_id']))
|
||||
{
|
||||
$listId = intval($requestBody['list_id']);
|
||||
}
|
||||
|
||||
$this->StockService->AddMissingProductsToShoppingList($listId);
|
||||
return $this->EmptyApiResponse($response);
|
||||
}
|
||||
|
||||
public function ClearShoppingList(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
$this->StockService->ClearShoppingList();
|
||||
$requestBody = $request->getParsedBody();
|
||||
|
||||
$listId = 1;
|
||||
if (array_key_exists('list_id', $requestBody) && !empty($requestBody['list_id']) && is_numeric($requestBody['list_id']))
|
||||
{
|
||||
$listId = intval($requestBody['list_id']);
|
||||
}
|
||||
|
||||
$this->StockService->ClearShoppingList($listId);
|
||||
return $this->EmptyApiResponse($response);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user