mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Fixed external barcode lookup (plugin) add product handling related to barcodes (fixes #1568)
This commit is contained in:
@@ -510,10 +510,16 @@ class StockService extends BaseService
|
||||
if ($addFoundProduct === true)
|
||||
{
|
||||
// Add product to database and include new product id in output
|
||||
$newRow = $this->getDatabase()->products()->createRow($pluginOutput);
|
||||
$newRow->save();
|
||||
$productData = $pluginOutput;
|
||||
unset($productData['barcode']);
|
||||
$newProductRow = $this->getDatabase()->products()->createRow($productData);
|
||||
$newProductRow->save();
|
||||
$this->getDatabase()->product_barcodes()->createRow([
|
||||
'product_id' => $newProductRow->id,
|
||||
'barcode' => $pluginOutput['barcode']
|
||||
])->save();
|
||||
|
||||
$pluginOutput['id'] = $newRow->id;
|
||||
$pluginOutput['id'] = $newProductRow->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user