Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-2889

Event Search : Return event types other than the ones requested if event doesn't have an end date

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: CiviEvent
    • Labels:
      None

      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.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              dgg David Greenberg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: