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:
kriddles
2020-01-17 10:54:34 -06:00
committed by Bernd Bestel
parent d4bec3bd10
commit 2a608c41e9
7 changed files with 96 additions and 32 deletions

View File

@@ -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