From 4f6075d8c5de02449d945b1376529412afef0a30 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 24 Aug 2024 18:22:39 +0200 Subject: [PATCH] Fixed product barcode scanning on the recipe ingredient edit page (fixes #2572) --- changelog/76_UNRELEASED_xxxx-xx-xx.md | 1 + controllers/RecipesController.php | 2 ++ views/recipeposform.blade.php | 1 + 3 files changed, 4 insertions(+) diff --git a/changelog/76_UNRELEASED_xxxx-xx-xx.md b/changelog/76_UNRELEASED_xxxx-xx-xx.md index 271abab4..5ddfc24e 100644 --- a/changelog/76_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/76_UNRELEASED_xxxx-xx-xx.md @@ -26,6 +26,7 @@ - When self producing a product ("Produces product" recipe option) the name of the recipe is now added to the note field of the created stock entry - Fixed that when `FEATURE_FLAG_STOCK_STOCK` was set to `false`, the "Put missing products on shopping list"-button was not visible +- Fixed that scanning a product barcode on the recipe ingredient edit page didn't work ### Meal plan diff --git a/controllers/RecipesController.php b/controllers/RecipesController.php index ed7b1ed6..f0c4305a 100644 --- a/controllers/RecipesController.php +++ b/controllers/RecipesController.php @@ -182,6 +182,7 @@ class RecipesController extends BaseController 'recipe' => $this->getDatabase()->recipes($args['recipeId']), 'recipePos' => new \stdClass(), 'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'), + 'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(), 'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'), 'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved() ]); @@ -193,6 +194,7 @@ class RecipesController extends BaseController 'recipe' => $this->getDatabase()->recipes($args['recipeId']), 'recipePos' => $this->getDatabase()->recipes_pos($args['recipePosId']), 'products' => $this->getDatabase()->products()->orderBy('name', 'COLLATE NOCASE'), + 'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(), 'quantityUnits' => $this->getDatabase()->quantity_units()->orderBy('name', 'COLLATE NOCASE'), 'quantityUnitConversionsResolved' => $this->getDatabase()->cache__quantity_unit_conversions_resolved() ]); diff --git a/views/recipeposform.blade.php b/views/recipeposform.blade.php index 5448e8db..3db4bc5a 100644 --- a/views/recipeposform.blade.php +++ b/views/recipeposform.blade.php @@ -45,6 +45,7 @@ @include('components.productpicker', array( 'products' => $products, + 'barcodes' => $barcodes, 'nextInputSelector' => '#amount' ))