Make it possible to mark a product as opened (closes #86)

This commit is contained in:
Bernd Bestel
2018-11-17 19:39:37 +01:00
parent 816ca6460f
commit 10ea9c44fd
12 changed files with 356 additions and 8 deletions

View File

@@ -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());