Moodle

flatfile enrolment gives a warning in apache logs and do not collect teacher's mails

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.7.2
  • Fix Version/s: 1.7.7, 1.8.8, 1.9.4
  • Component/s: Enrolments
  • Labels:
    None
  • Environment:
    any
  • Affected Branches:
    MOODLE_17_STABLE
  • Fixed Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

Description

When using flatfile enrolment I noticed a lot of warnings in apache 's log (one for every student) as follows :

[Sun Sep 23 00:45:02 2007] [error] [client 127.0.0.1] SQL Column 'sortorder' in order clause is ambiguous in /var/www
/html/moodle172/lib/dmllib.php on line 886. STATEMENT:   SELECT u.*,ra.hidden FROM mdl_user u\n                INNER
JOIN mdl_role_assignments ra ON ra.userid = u.id\n                INNER JOIN mdl_role r ON r.id = ra.roleid\n
        LEFT OUTER JOIN mdl_user_lastaccess ul ON (ul.userid = u.id AND ul.courseid = 59)\n                 WHERE ra.
contextid  IN (65,3,1)\n                  AND u.deleted = 0\n                  AND ra.roleid in (1,3)\n
        \n                       ORDER BY sortorder ASC  with limits (, )

This is due to the SQL in line 204 of enrol/flatfile/enrol.php that use column 'sortorder' that is defined in both mdl_role and mdl_role_assignaments.

if ( empty($elog) and ($fields[0] == "add") ) {
if ($fields[1] == "student") {
if ($teachers = get_users_by_capability($context, 'moodle/course:update', 'u.*,ra.hidden', 'sortorder ASC')) {
I changed it to
if ($teachers = get_users_by_capability($context, 'moodle/course:update', 'u.*,ra.hidden', 'ra.sortorder ASC'))

Cheers

I peeked into 1.82 code and the line 204 is the same, so I guess latest Moodle still gives these warnings ...

Issue Links

Activity

Hide
Tim Hunt added a comment -

Thanks Patrick.

Show
Tim Hunt added a comment - Thanks Patrick.

People

Vote (5)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: