Undo formatting changes

This commit is contained in:
Bernd Bestel 2021-08-16 19:47:00 +02:00
parent aaa2131253
commit 25255287a7
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -282,10 +282,10 @@ class StockApiController extends BaseApiController
{ {
$specificStockEntryId = $requestBody['stock_entry_id']; $specificStockEntryId = $requestBody['stock_entry_id'];
} }
else if (array_key_exists('stock_id', $args) && !empty($args['stock_id'])) elseif (array_key_exists('stock_id', $args) && !empty($args['stock_id']))
{ {
$specificStockEntryId = $args['stock_id']; $specificStockEntryId = $args['stock_id'];
} }
$locationId = null; $locationId = null;
if (array_key_exists('location_id', $requestBody) && !empty($requestBody['location_id']) && is_numeric($requestBody['location_id'])) if (array_key_exists('location_id', $requestBody) && !empty($requestBody['location_id']) && is_numeric($requestBody['location_id']))
@ -326,23 +326,23 @@ class StockApiController extends BaseApiController
{ {
try try
{ {
if (Grocycode::Validate($barcode)) if (Grocycode::Validate($barcode))
{ {
$gc = new Grocycode($barcode); $gc = new Grocycode($barcode);
if ($gc->GetType() != Grocycode::PRODUCT) if ($gc->GetType() != Grocycode::PRODUCT)
{ {
throw new \Exception("Invalid grocycode type"); throw new \Exception('Invalid grocycode type');
} }
$args['productId'] = $gc->GetId(); $args['productId'] = $gc->GetId();
if ($gc->GetExtraData()) if ($gc->GetExtraData())
{ {
$args['stock_id'] = $gc->GetExtraData()[0]; $args['stock_id'] = $gc->GetExtraData()[0];
} }
} }
else else
{ {
$args['productId'] = $this->getStockService()->GetProductIdFromBarcode($args['barcode']); $args['productId'] = $this->getStockService()->GetProductIdFromBarcode($args['barcode']);
} }
return $this->ConsumeProduct($request, $response, $args); return $this->ConsumeProduct($request, $response, $args);
} }
catch (\Exception $ex) catch (\Exception $ex)