Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-23880

Error in get_enrolled_sql causes fatal error whenever there is a prohibited role on the required capability

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Enrolments
    • Labels:
      None
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      Tomaz encountered an error yesterday whereby he created a choice but when ever he went to view it received the following error:

      Debug info: Unknown column 'eu1_ra4' in 'where clause'
      SELECT u.id,u.picture,u.firstname,u.lastname,u.imagealt,u.email,u.idnumber
      FROM mdl_user u
      JOIN (SELECT DISTINCT eu1_u.id
      FROM mdl_user eu1_u
      JOIN mdl_role_assignments eu1_ra3 ON (eu1_ra3.userid = eu1_u.id AND eu1_ra3.roleid IN (5,4,3,1) AND eu1_ra3.contextid IN (1,1086,1271,2261,2305))
      LEFT JOIN mdl_role_assignments eu1_ra4 ON (eu1_ra4.userid = eu1_u.id AND eu1_ra4.roleid IN (10) AND eu1_ra4.contextid IN (1,1086,1271,2261,2305))
      JOIN mdl_user_enrolments eu1_ue ON eu1_ue.userid = eu1_u.id
      JOIN mdl_enrol eu1_e ON (eu1_e.id = eu1_ue.enrolid AND eu1_e.courseid = ?)
      WHERE eu1_ra4 IS NULL AND eu1_u.deleted = 0 AND eu1_u.username <> 'guest') je ON je.id = u.id
      WHERE u.deleted = 0 ORDER BY u.lastname ASC,u.firstname ASC
      [array (
      0 => '115',
      )]

      It appears there is simply a missing a field in the SQL there, I'll track it down now and see what I find.

      Cheers
      Sam

        Attachments

          Activity

            People

            Assignee:
            samhemelryk Sam Hemelryk
            Reporter:
            samhemelryk Sam Hemelryk
            Tester:
            Nobody
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              24/Nov/10