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

External Enrollment enrol.php v.1.10 calling wrong datalib.php function

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.5.3
    • Fix Version/s: None
    • Component/s: Enrolments
    • Labels:
      None
    • Environment:
      All
    • Database:
      Any
    • Affected Branches:
      MOODLE_15_STABLE

      Description

      There is a bug in the latest external enrollment enrol.php code version 1.10. I'm not sure if this is scheduled for 1.5.3, or straight to 1.6. The bug results in queries of the form:

      SELECT 22 FROM ...

      due to the wrong datalib.php function being called.

      Around line 74:

      // unenrol only if it's a record pulled from external db

      if (get_record_select('user_students', 'userid', $user->id, 'courseid', $courseid, 'enrol', 'database'))

      The line should be calling the get_record() function which takes field/value pairs and not get_record_select().

      I changed mine to this and it worked:

      // unenrol only if it's a record pulled from external db

      if (get_record('user_students', 'userid', $user->id, 'courseid', $courseid, 'enrol', 'database'))

        Gliffy Diagrams

          Activity

          Hide
          dougiamas Martin Dougiamas added a comment -

          From Martin Langhoff (martin at catalyst.net.nz) Thursday, 8 September 2005, 06:51 AM:

          Thanks! This slipped past me, because it errors out differently on MySQL and Postgres, apparently. On MySQL, it deletes all manual enrolments (how? why?) on Postgres, it never deletes database enrolments.

          Anyway, it was a thinko on my part when rewriting Scott Krajewski's patch - fixed.

          From Martin Langhoff (martin at catalyst.net.nz) Thursday, 8 September 2005, 06:51 AM:

          Closing as fixed - reopen if necessary.

          Show
          dougiamas Martin Dougiamas added a comment - From Martin Langhoff (martin at catalyst.net.nz) Thursday, 8 September 2005, 06:51 AM: Thanks! This slipped past me, because it errors out differently on MySQL and Postgres, apparently. On MySQL, it deletes all manual enrolments (how? why?) on Postgres, it never deletes database enrolments. Anyway, it was a thinko on my part when rewriting Scott Krajewski's patch - fixed. From Martin Langhoff (martin at catalyst.net.nz) Thursday, 8 September 2005, 06:51 AM: Closing as fixed - reopen if necessary.
          Hide
          mblake Michael Blake added a comment -

          assign to a valid user

          Show
          mblake Michael Blake added a comment - assign to a valid user

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: