From 6da637ab6691ce715c3efb43ab69209397c10528 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Mon, 30 May 2022 17:20:15 +0200 Subject: [PATCH] Fixed API filter `>=` and `<=` comparison (fixes #1904) --- changelog/68_UNRELEASED_xxxx-xx-xx.md | 1 + controllers/BaseApiController.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog/68_UNRELEASED_xxxx-xx-xx.md b/changelog/68_UNRELEASED_xxxx-xx-xx.md index 616edd20..22feeba1 100644 --- a/changelog/68_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/68_UNRELEASED_xxxx-xx-xx.md @@ -59,3 +59,4 @@ - Endpoint `/stock/products/{productId}`: New field/property `default_consume_location` (contains the products default consume location object) - Endpoint `/stock/products/{productId}/add`: Fixed that the request body parameter `transaction_type` was ignored / always set to `purchase` - Fixed that the endpoint `/stock/products/by-barcode/{barcode}/open` didn't handle stock entries provided by a grocycode (thanks @jtommi) +- Fixed that less or equal (`<=`) and greater or equal (`>=`) filter comparisons didn't work (optional `query[]` request query parameter on most endpoints) diff --git a/controllers/BaseApiController.php b/controllers/BaseApiController.php index 56714c91..609c9f05 100644 --- a/controllers/BaseApiController.php +++ b/controllers/BaseApiController.php @@ -8,7 +8,7 @@ class BaseApiController extends BaseController { const PATTERN_FIELD = '[A-Za-z_][A-Za-z0-9_]+'; - const PATTERN_OPERATOR = '!?(=|~|<|>|(>=)|(<=)|(§))'; + const PATTERN_OPERATOR = '!?((>=)|(<=)|=|~|<|>|(§))'; const PATTERN_VALUE = '[A-Za-z\p{L}\p{M}0-9*_.$#^| -\\\]+';