Make it possible to provide a different location for added product during inventory (closes #183)

This commit is contained in:
Bernd Bestel
2019-04-05 21:26:44 +02:00
parent 886e272c03
commit b6e80580ed
6 changed files with 25 additions and 4 deletions

View File

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