From ad0dbdfc2269a130432dd34ceb40ce4336424740 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Thu, 6 Jan 2022 13:42:38 +0100 Subject: [PATCH] Lookup product barcodes case insensitive (fixes #1734) --- changelog/66_UNRELEASED_xxxx-xx-xx.md | 1 + services/StockService.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog/66_UNRELEASED_xxxx-xx-xx.md b/changelog/66_UNRELEASED_xxxx-xx-xx.md index 991af20a..9577e561 100644 --- a/changelog/66_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/66_UNRELEASED_xxxx-xx-xx.md @@ -4,3 +4,4 @@ - Fixed that stock entry labels on purchase were printed, even when "No label" was selected (was only a problem when running label printer WebHooks server side) - Fixed that formatted (HTML) text for the (hidden by default) product description column on the stock overview page was not correctly displayed - Fixed that numeric and date-time sorting of table columns on the stock entries page did not work correctly (thanks @MasterofJOKers) +- Fixed that the barcode lookup for the "Stock by-barcode" API endpoints was case sensitive diff --git a/services/StockService.php b/services/StockService.php index bfc74aed..49fe4b53 100644 --- a/services/StockService.php +++ b/services/StockService.php @@ -775,7 +775,7 @@ class StockService extends BaseService return intval($gc->GetId()); } - $potentialProduct = $this->getDatabase()->product_barcodes()->where('barcode = :1', $barcode)->fetch(); + $potentialProduct = $this->getDatabase()->product_barcodes()->where('barcode = :1 COLLATE NOCASE', $barcode)->fetch(); if ($potentialProduct === null) { throw new \Exception("No product with barcode $barcode found");