From: ethem Date: Thu, 15 Jun 2006 08:06:52 +0000 (+0000) Subject: Order by order count. Courses that have many orders are emailed first. Merged from... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b282e815d5c0083dbc092c748b2b8a255de58f18;p=moodle.git Order by order count. Courses that have many orders are emailed first. Merged from 16_stable. --- diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php index ba7dd9fed5..b1f62b1f6c 100755 --- a/enrol/authorize/enrol.php +++ b/enrol/authorize/enrol.php @@ -666,16 +666,16 @@ class enrolment_plugin_authorize $adminuser = get_admin(); email_to_user($adminuser, $adminuser, $subject, $message); if (!empty($CFG->an_teachermanagepay) and !empty($CFG->an_emailexpiredteacher)) { - $sql = "SELECT DISTINCT E.courseid, COUNT(E.courseid) AS count " . + $sql = "SELECT E.courseid, COUNT(E.courseid) AS cnt " . "FROM {$CFG->prefix}enrol_authorize E " . - "WHERE $select GROUP BY E.courseid"; + "WHERE $select GROUP BY E.courseid ORDER BY cnt DESC"; $message = ''; $subject = ''; $lastcourse = 0; $lastcount = 0; $courseidandcounts = get_records_sql($sql); foreach($courseidandcounts as $courseidandcount) { if ($lastcourse != $courseidandcount->courseid) { $lastcourse = $courseidandcount->courseid; - $lastcount = $courseidandcount->count; + $lastcount = $courseidandcount->cnt; $a = new stdClass; $a->pending = $lastcount; $a->days = $CFG->an_emailexpired;