mirror of
https://github.com/grocy/grocy.git
synced 2025-08-13 01:06:23 +00:00
Make it possible to mark a product as opened (closes #86)
This commit is contained in:
@@ -119,6 +119,25 @@ class StockApiController extends BaseApiController
|
||||
}
|
||||
}
|
||||
|
||||
public function OpenProduct(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
$specificStockEntryId = "default";
|
||||
if (isset($request->getQueryParams()['stock_entry_id']) && !empty($request->getQueryParams()['stock_entry_id']))
|
||||
{
|
||||
$specificStockEntryId = $request->getQueryParams()['stock_entry_id'];
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$bookingId = $this->StockService->OpenProduct($args['productId'], $args['amount'], $specificStockEntryId);
|
||||
return $this->ApiResponse(array('booking_id' => $bookingId));
|
||||
}
|
||||
catch (\Exception $ex)
|
||||
{
|
||||
return $this->VoidApiActionResponse($response, false, 400, $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function CurrentStock(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
return $this->ApiResponse($this->StockService->GetCurrentStock());
|
||||
|
Reference in New Issue
Block a user