Details
Description
The $whereClause created for the Event Search in CRM/Event/Page/ManageEvent.php doesn't handle events w/ NULL end date properly. The net effect is that these events are returned regardless of their event type.
For example, the query below is created if you check Conference and Exhibition event types. An event of type Fund-raiser will also be returned by this query IF it has only a start date (end_date IS NULL).
SELECT *
FROM civicrm_event
WHERE event_type_id IN (1,2) AND end_date >= 20080324124741 OR end_date IS NULL AND domain_id = %7
ORDER BY title asc
LIMIT 0, 50
I think the correct fix is demonstrated by this sample query below (adding parens):
SELECT *
FROM civicrm_event
WHERE event_type_id IN (1,2) AND (end_date >= 20080324124741 OR end_date IS NULL) AND domain_id = %7
ORDER BY title asc
LIMIT 0, 50
NOTE: This fix assumes that Events with NULL end dates are ongoing - and we will always return them in the "Current and Upcoming Events" filter. This may or may not be a good assumption depending on how folks are using this case.