Fixed shopping list item form product barcode scan handling (fixes #1940)

This commit is contained in:
Bernd Bestel 2022-07-12 19:00:40 +02:00
parent b57ba59243
commit 8cb9157c73
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
4 changed files with 5 additions and 2 deletions

View File

@ -12,7 +12,7 @@
### Shopping list
- xxx
- Fixed that products could not be added to the shopping list via barcode scanning
### Recipes

View File

@ -400,6 +400,7 @@ class StockController extends BaseController
{
return $this->renderPage($response, 'shoppinglistitemform', [
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
'mode' => 'create',
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),
@ -412,6 +413,7 @@ class StockController extends BaseController
return $this->renderPage($response, 'shoppinglistitemform', [
'listItem' => $this->getDatabase()->shopping_list($args['itemId']),
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
'shoppingLists' => $this->getDatabase()->shopping_lists()->orderBy('name', 'COLLATE NOCASE'),
'mode' => 'edit',
'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'),

View File

@ -277,7 +277,7 @@ $('#product_id_text_input').on('blur', function(e)
{
if (barcodeResult.length > 0)
{
existsAsProduct = true;
existsAsBarcode = true;
}
Grocy.Api.Get('objects/products?query[]=name=' + input,

View File

@ -61,6 +61,7 @@
@php if($mode == 'edit') { $productId = $listItem->product_id; } else { $productId = ''; } @endphp
@include('components.productpicker', array(
'products' => $products,
'barcodes' => $barcodes,
'nextInputSelector' => '#amount',
'isRequired' => true,
'prefillById' => $productId,