mirror of
https://github.com/grocy/grocy.git
synced 2025-08-13 01:06:23 +00:00
Stock detail updates (#493)
* Fix spelling * stockdetail refresh with location name * Stock updates * change stock_row_id to id * fix stockdetail refresh rows after clicking undo * fix stockdetail consume spoiled
This commit is contained in:
@@ -124,7 +124,7 @@ class StockApiController extends BaseApiController
|
||||
throw new \Exception('Request body could not be parsed (probably invalid JSON format or missing/wrong Content-Type header)');
|
||||
}
|
||||
|
||||
if (!array_key_exists('stock_row_id', $requestBody))
|
||||
if (!array_key_exists('id', $requestBody))
|
||||
{
|
||||
throw new \Exception('A stock row id is required');
|
||||
}
|
||||
@@ -152,7 +152,7 @@ class StockApiController extends BaseApiController
|
||||
$locationId = $requestBody['location_id'];
|
||||
}
|
||||
|
||||
$bookingId = $this->StockService->EditStock($requestBody['stock_row_id'], $requestBody['amount'], $bestBeforeDate, $locationId, $price);
|
||||
$bookingId = $this->StockService->EditStock($requestBody['id'], $requestBody['amount'], $bestBeforeDate, $locationId, $price);
|
||||
return $this->ApiResponse($this->Database->stock_log($bookingId));
|
||||
}
|
||||
catch (\Exception $ex)
|
||||
@@ -388,7 +388,7 @@ class StockApiController extends BaseApiController
|
||||
return $this->ApiResponse($this->StockService->GetCurrentStock());
|
||||
}
|
||||
|
||||
public function CurrentVolatilStock(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
public function CurrentVolatileStock(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
$nextXDays = 5;
|
||||
if (isset($request->getQueryParams()['expiring_days']) && !empty($request->getQueryParams()['expiring_days']) && is_numeric($request->getQueryParams()['expiring_days']))
|
||||
@@ -580,6 +580,11 @@ class StockApiController extends BaseApiController
|
||||
return $this->ApiResponse($this->StockService->GetProductStockLocations($args['productId']));
|
||||
}
|
||||
|
||||
public function StockEntry(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
return $this->ApiResponse($this->StockService->GetStockEntry($args['entryId']));
|
||||
}
|
||||
|
||||
public function StockBooking(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
try
|
||||
|
Reference in New Issue
Block a user