MDL-40358 Enrolments: Fixed sql when user is suspended
authorRajesh Taneja <rajesh@moodle.com>
Wed, 10 Jul 2013 07:30:47 +0000 (15:30 +0800)
committerMarina Glancy <marina@moodle.com>
Wed, 10 Jul 2013 07:40:20 +0000 (17:40 +1000)
enrol/locallib.php

index 6cca938..29f6eeb 100644 (file)
@@ -302,8 +302,8 @@ class course_enrolment_manager {
                              'now1' => $now,
                              'now2' => $now);
         } else if ($this->statusfilter === ENROL_USER_SUSPENDED) {
-            $sql .= " AND ue.status = :inactive OR e.status = :disabled OR ue.timestart > :now1
-                    OR (ue.timeend <> 0 AND ue.timeend < :now2)";
+            $sql .= " AND (ue.status = :inactive OR e.status = :disabled OR ue.timestart > :now1
+                    OR (ue.timeend <> 0 AND ue.timeend < :now2))";
             $now = round(time(), -2); // rounding helps caching in DB
             $params += array('disabled' => ENROL_INSTANCE_DISABLED,
                              'inactive' => ENROL_USER_SUSPENDED,