From 619a740451c7aee6b64a80236732a8a89be36a70 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 6 Jan 2023 13:35:48 +1100 Subject: [PATCH] Fixes for query filters --- app/Filters/QuoteFilters.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Filters/QuoteFilters.php b/app/Filters/QuoteFilters.php index 082fe692e9b6..517479aa121d 100644 --- a/app/Filters/QuoteFilters.php +++ b/app/Filters/QuoteFilters.php @@ -85,15 +85,19 @@ class QuoteFilters extends QueryFilters } if (in_array('expired', $status_parameters)) { - $this->builder->where('status_id', Quote::STATUS_SENT) + $this->builder->orWhere(function ($query){ + $query->where('status_id', Quote::STATUS_SENT) ->whereNotNull('due_date') ->where('due_date', '<=', now()->toDateString()); + }); } if (in_array('upcoming', $status_parameters)) { - $this->builder->where('status_id', Quote::STATUS_SENT) + $this->builder->orWhere(function ($query){ + $query->where('status_id', Quote::STATUS_SENT) ->where('due_date', '>=', now()->toDateString()) ->orderBy('due_date', 'DESC'); + }); } return $this->builder;