mirror of
https://github.com/grocy/grocy.git
synced 2026-03-27 23:29:25 +01: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)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user