Use exact matches for product barcode lookups (closes #366)

This commit is contained in:
Bernd Bestel 2019-09-24 09:52:05 +02:00
parent 53c56cc1cb
commit 099ac7e75a
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
3 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
- Fixed that barcode lookups now compare the whole barcode, not parts of it (e. g. when you have two products with the barcodes "$1" and "$10" and scan "$1" maybe the product of "$10" was found till now)
- It's now possible to display a recipe directly from the meal plan (new "eye button") (thanks @kriddles)
- Improved the responsiveness of the meal plan and calendar page by automatically switching to a day calendar view on smaller screens (thanks for the idea @kriddles)
- The calendar now also contains all planned recipes from the meal plan on the corresponding day

View File

@ -134,7 +134,7 @@ $('#product_id_text_input').on('blur', function(e)
}
var input = $('#product_id_text_input').val().toString();
var possibleOptionElement = $("#product_id option[data-additional-searchdata*=\"" + input + "\"]").first();
var possibleOptionElement = $("#product_id option[data-additional-searchdata*=\"" + input + ",\"]").first();
if (GetUriParam('addbarcodetoselection') === undefined && possibleOptionElement.length > 0)
{

View File

@ -17,7 +17,7 @@
<select class="form-control product-combobox barcodescanner-input" id="product_id" name="product_id" @if($isRequired) required @endif @if($disabled) disabled @endif>
<option value=""></option>
@foreach($products as $product)
<option data-additional-searchdata="{{ $product->barcode }}" value="{{ $product->id }}">{{ $product->name }}</option>
<option data-additional-searchdata="{{ $product->barcode }}@if(!empty($product->barcode)),@endif" value="{{ $product->id }}">{{ $product->name }}</option>
@endforeach
</select>
<div class="invalid-feedback">{{ $__t('You have to select a product') }}</div>