Skip to content

Commit

Permalink
Merge pull request #45 from ToddHossack/tki-past-events-fix
Browse files Browse the repository at this point in the history
Revised EventsForm to use more comprehensive past events query
  • Loading branch information
anselmdk authored Nov 22, 2017
2 parents 5871861 + 8022f17 commit afba392
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion code/admin/forms/EventsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,14 @@ public function __construct($controller, $name)
'Root.Past', _t('Event.PAST_EVENT_PLURAL','Past events')
);

// Find all past events, including those with null start time
$time = date('Y-m-d', time());
$pastEvents = PublicEvent::get()
->where("\"StartDateTime\" < '$time' OR \"StartDateTime\" IS NULL")
->sort('StartDateTime DESC');

$pastGridField = GridField::create('PastEvents', '',
CalendarHelper::past_events()->sort('StartDateTime DESC'),
$pastEvents,
$gridConfig);

$fields->addFieldToTab('Root.Past',$pastGridField);
Expand Down

0 comments on commit afba392

Please sign in to comment.