From 73110b2a88518ecca9744d9256c6d186256fd42d Mon Sep 17 00:00:00 2001 From: larssandergreen Date: Thu, 25 May 2023 17:12:54 -0600 Subject: [PATCH] Don't show events without end date forever on Manage Events --- CRM/Event/Page/ManageEvent.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Event/Page/ManageEvent.php b/CRM/Event/Page/ManageEvent.php index c981862362..4a91db3640 100644 --- a/CRM/Event/Page/ManageEvent.php +++ b/CRM/Event/Page/ManageEvent.php @@ -536,12 +536,14 @@ ORDER BY start_date desc } else { $curDate = date('YmdHis'); - $clauses[] = "(end_date >= {$curDate} OR end_date IS NULL)"; + $dayBefore = date_sub(date_create(), date_interval_create_from_date_string("1 day"))->format('YmdHis'); + $clauses[] = "(end_date >= {$curDate} OR (end_date IS NULL AND start_date >= {$dayBefore}))"; } } else { $curDate = date('YmdHis'); - $clauses[] = "(end_date >= {$curDate} OR end_date IS NULL)"; + $dayBefore = date_sub(date_create(), date_interval_create_from_date_string("1 day"))->format('YmdHis'); + $clauses[] = "(end_date >= {$curDate} OR (end_date IS NULL AND start_date >= {$dayBefore}))"; } if ($sortBy && -- 2.25.1