From 9d02fbc13cb0d4efe953af08ab326fcb8e3cc783 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 10 Mar 2019 14:53:06 +0100 Subject: [PATCH] Again some changes for the new product-by-barcode API method (references #171) --- services/StockService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/StockService.php b/services/StockService.php index 6abc247c..6611aa51 100644 --- a/services/StockService.php +++ b/services/StockService.php @@ -40,7 +40,7 @@ class StockService extends BaseService public function GetProductIdFromBarcode(string $barcode) { - $potentialProduct = $this->Database->products()->where('barcode LIKE :1', '%' . $barcode . '%')->limit(1)->fetch(); + $potentialProduct = $this->Database->products()->where("',' || barcode || ',' LIKE '%,' || :1 || ',%' AND IFNULL(barcode, '') != ''", $barcode)->limit(1)->fetch(); if ($potentialProduct === null) {