]> git.mjollnir.org Git - moodle.git/commitdiff
Bug: Sending email to admins/teachers the count of pending orders expiring. "Column...
authorethem <ethem>
Thu, 27 Jul 2006 10:57:58 +0000 (10:57 +0000)
committerethem <ethem>
Thu, 27 Jul 2006 10:57:58 +0000 (10:57 +0000)
We joins 2 tables: course and enrol_authorize. We didn't select course.timecreated, but it gives this error.
Merged from MOODLE_16_STABLE.

enrol/authorize/enrol.php

index 266562b81c5cb45782849998ae7e16d9692b005d..b3652337dfb54ca837ef260f9f650a4178cf9455 100755 (executable)
@@ -706,7 +706,7 @@ class enrolment_plugin_authorize
         $sql = "SELECT E.*, C.fullname, C.enrolperiod " .
                "FROM {$CFG->prefix}enrol_authorize E " .
                "INNER JOIN {$CFG->prefix}course C ON C.id = E.courseid " .
-               "WHERE (status = '" .AN_STATUS_AUTH. "') " .
+               "WHERE (E.status = '" .AN_STATUS_AUTH. "') " .
                "  AND (E.timecreated < '$timediffcnf') AND (E.timecreated > '$timediff30')";
 
         if (!$orders = get_records_sql($sql)) {
@@ -875,11 +875,12 @@ class enrolment_plugin_authorize
         }
 
         $sorttype = empty($CFG->an_sorttype) ? 'ttl' : $CFG->an_sorttype;
+        $where = "(E.status='". AN_STATUS_AUTH ."') AND (E.timecreated<'$timediffem') AND (E.timecreated>'$timediff30')";
         $sql = "SELECT E.courseid, E.currency, C.fullname, C.shortname, " .
                "COUNT(E.courseid) AS cnt, SUM(E.amount) as ttl " .
                "FROM {$CFG->prefix}enrol_authorize E " .
                "INNER JOIN {$CFG->prefix}course C ON C.id = E.courseid " .
-               "WHERE $select GROUP BY E.courseid ORDER BY $sorttype DESC";
+               "WHERE $where GROUP BY E.courseid ORDER BY $sorttype DESC";
 
         $courseinfos = get_records_sql($sql);
         foreach($courseinfos as $courseinfo) {