Skip to content

Commit

Permalink
Merge pull request #56 from cmcramer/master
Browse files Browse the repository at this point in the history
Announcements not filtering in SilverStripe 3.1.5
  • Loading branch information
unclecheese committed Jul 2, 2014
2 parents fddd8f6 + 1d8b49a commit a140d2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
silverstripe-event-calendar
===========================

The Event Calendar module for SilverStripe

Fixes for Announcements not filtering correctly
10 changes: 4 additions & 6 deletions code/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,9 @@ public function getEventList($start, $end, $filter = null, $limit = null, $annou

$announcements = DataList::create($this->getAnnouncementClass())
->filter(array(
"CalendarID" => $calendar->ID
))
->exclude(array(
"StartDate:LessThan" => $start,
"EndDate:GreaterThan" => $end,
"CalendarID" => $calendar->ID,
"StartDate:LessThan:Not" => $start,
"EndDate:GreaterThan:Not" => $end,
));
if($announcement_filter) {
$announcements = $announcements->where($announcement_filter);
Expand Down Expand Up @@ -411,7 +409,7 @@ public function UpcomingEvents($limit = 5, $filter = null) {
public function UpcomingAnnouncements($limit = 5, $filter = null) {
return $this->Announcements()
->filter(array(
'StartDate:GreaterThan' => 'DATE(NOW())'
'StartDate:GreaterThan' => 'NOW'
))
->where($filter)
->limit($limit);
Expand Down

0 comments on commit a140d2e

Please sign in to comment.