From 905e5fbb726e761bb0c2d911ce753fa71e8a5cc5 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Mon, 2 Dec 2019 17:27:43 +1100 Subject: [PATCH] Fix for strict SQL languages (Pgsql) When the value is null [id >= ''] an error is thrown, not being an integer, while [id >= null] will return nil results, curiously. Here we emulate infinity by using a large-ish number instead of null. In future if this becomes a problem we may need to resort to multiple condition definitions as a more verbose solution, for example: - For when both are set (conditions: id >= ':min' and id <= ':max') - For when min is set (conditionsMin: id >= ':min') - For when max is set (conditionsMax: id >= ':max') --- modules/backend/widgets/Filter.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/backend/widgets/Filter.php b/modules/backend/widgets/Filter.php index a508007fe..3562cd49d 100644 --- a/modules/backend/widgets/Filter.php +++ b/modules/backend/widgets/Filter.php @@ -794,12 +794,11 @@ class Filter extends WidgetBase if (isset($min) || isset($max)) { /* * Condition - * */ if ($scopeConditions = $scope->conditions) { $query->whereRaw(DbDongle::parse(strtr($scopeConditions, [ - ':min' => $min, - ':max' => $max + ':min' => $min === null ? -999999999 : $min, + ':max' => $max === null ? 999999999 : $max ]))); } /*