mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 12:26:15 +02:00
Fixed external barcode lookup (plugin) add product handling related to barcodes (fixes #1568)
This commit is contained in:
parent
4d0c5502a1
commit
1d5ca5ed64
|
|
@ -510,10 +510,16 @@ class StockService extends BaseService
|
||||||
if ($addFoundProduct === true)
|
if ($addFoundProduct === true)
|
||||||
{
|
{
|
||||||
// Add product to database and include new product id in output
|
// Add product to database and include new product id in output
|
||||||
$newRow = $this->getDatabase()->products()->createRow($pluginOutput);
|
$productData = $pluginOutput;
|
||||||
$newRow->save();
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user