From 08b9be083c2daedd715f574c1ef62c264204d226 Mon Sep 17 00:00:00 2001 From: ethem Date: Thu, 27 Jul 2006 10:57:58 +0000 Subject: [PATCH] Bug: Sending email to admins/teachers the count of pending orders expiring. "Column 'timecreated' in where clause is ambiguous." 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php index 266562b81c..b3652337df 100755 --- a/enrol/authorize/enrol.php +++ b/enrol/authorize/enrol.php @@ -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) { -- 2.39.5