mirror of
https://github.com/grocy/grocy.git
synced 2026-04-04 03:46:16 +02:00
Handle stock_id in OpenProductByBarcode
This commit is contained in:
parent
9c1fd176c0
commit
4513e850c3
|
|
@ -583,6 +583,16 @@ class StockApiController extends BaseApiController
|
|||
try
|
||||
{
|
||||
$args['productId'] = $this->getStockService()->GetProductIdFromBarcode($args['barcode']);
|
||||
|
||||
if (Grocycode::Validate($args['barcode'])) {
|
||||
$gc = new Grocycode($args['barcode']);
|
||||
if ($gc->GetExtraData()) {
|
||||
$requestBody = $request->getParsedBody();
|
||||
$requestBody['stock_entry_id'] = $gc->GetExtraData()[0];
|
||||
$request = $request->withParsedBody($requestBody);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->OpenProduct($request, $response, $args);
|
||||
}
|
||||
catch (\Exception $ex)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user