mirror of
https://github.com/grocy/grocy.git
synced 2025-08-19 03:40:10 +00:00
Make it possible to provide a different location for added product during inventory (closes #183)
This commit is contained in:
@@ -171,7 +171,13 @@ class StockApiController extends BaseApiController
|
||||
$bestBeforeDate = $requestBody['best_before_date'];
|
||||
}
|
||||
|
||||
$bookingId = $this->StockService->InventoryProduct($args['productId'], $requestBody['new_amount'], $bestBeforeDate);
|
||||
$locationId = null;
|
||||
if (array_key_exists('location_id', $requestBody) && is_numeric($requestBody['location_id']))
|
||||
{
|
||||
$locationId = $requestBody['location_id'];
|
||||
}
|
||||
|
||||
$bookingId = $this->StockService->InventoryProduct($args['productId'], $requestBody['new_amount'], $bestBeforeDate, $locationId);
|
||||
return $this->ApiResponse($this->Database->stock_log($bookingId));
|
||||
}
|
||||
catch (\Exception $ex)
|
||||
|
@@ -48,7 +48,8 @@ class StockController extends BaseController
|
||||
public function Inventory(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
return $this->AppContainer->view->render($response, 'inventory', [
|
||||
'products' => $this->Database->products()->orderBy('name')
|
||||
'products' => $this->Database->products()->orderBy('name'),
|
||||
'locations' => $this->Database->locations()->orderBy('name')
|
||||
]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user