MDL-31086 Calendar : fix sql to get distinct list of courses
authorDan Marsden <dan@danmarsden.com>
Tue, 10 Jan 2012 00:57:44 +0000 (13:57 +1300)
committerAparup Banerjee <aparup@moodle.com>
Tue, 28 Feb 2012 06:20:38 +0000 (14:20 +0800)
calendar/lib.php

index e4e76cd..3db74c8 100644 (file)
@@ -1510,7 +1510,7 @@ function calendar_get_default_courses() {
     $courses = array();
     if (!empty($CFG->calendar_adminseesall) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
         list ($select, $join) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
-        $sql = "SELECT c.* $select
+        $sql = "SELECT DISTINCT c.* $select
                   FROM {course} c
                   JOIN {event} e ON e.courseid = c.id
                   $join";