Moodle
  1. Moodle
  2. MDL-27375

CLONE - External Database Participants not enrolled (enroled) in courses on login, but are enrolled (enroled) by enrol/database/cli/sync.php.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1, 2.1, 2.2
    • Fix Version/s: 2.0.4, 2.1.1
    • Component/s: Enrolments
    • Labels:
      None
    • Environment:
      Ubuntu 10.04 LTS, Zend Server CE 5.3, MySQL 5.1
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      1/ set up db sync with external database using UPPERCASE column names
      2/ log in as user that does not yet have courses synced
      3/ expected: user is enrolled into courses specified in external table automatically during login

      Show
      1/ set up db sync with external database using UPPERCASE column names 2/ log in as user that does not yet have courses synced 3/ expected: user is enrolled into courses specified in external table automatically during login
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w26_MDL-27375_m22_enrolcase

      Description

      I started with a fresh installation of Moodle 2.0.1+ (20110209). I enabled the LDAP authentication plugin and used my own PHP script to synchronize the users (we don't want ALL of them in Moodle by default). Then I enabled the External Database enrollment plugin. I created a few courses that I knew a particular student was in, and I logged in as that student. The student was not put in as a participant. I ran enrol/database/cli/sync.php and the student became a participant (along with many others). At least on my test site, students get enrolled properly by sync.php, but do not get enrolled at login time.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Gail Preuninger added a comment -

            We were able to reproduce a similar issue. Cause - external database field names contained uppercase letters.
            Resolution:
            Add following line of code to /enrol/database/lib.php file between lines 113: while ($fields = $rs->FetchRow()) {
            and 114: $fields = $this->db_decode($fields);
            $fields = array_change_key_case($fields, CASE_LOWER);

            Show
            Gail Preuninger added a comment - We were able to reproduce a similar issue. Cause - external database field names contained uppercase letters. Resolution: Add following line of code to /enrol/database/lib.php file between lines 113: while ($fields = $rs->FetchRow()) { and 114: $fields = $this->db_decode($fields); $fields = array_change_key_case($fields, CASE_LOWER);
            Hide
            Petr Skoda added a comment - - edited

            Thanks for the report and patch!

            Show
            Petr Skoda added a comment - - edited Thanks for the report and patch!
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Integrated, thanks! (20, 21 and master)

            Show
            Eloy Lafuente (stronk7) added a comment - Integrated, thanks! (20, 21 and master)
            Hide
            Eloy Lafuente (stronk7) added a comment - - edited

            Tested under Oracle DB, 2 enrolments into 2 courses were performed perfectly on login.
            Also tested under MySQL forcing upper column names on table creation, worked too.

            Passed! Thanks!

            Show
            Eloy Lafuente (stronk7) added a comment - - edited Tested under Oracle DB, 2 enrolments into 2 courses were performed perfectly on login. Also tested under MySQL forcing upper column names on table creation, worked too. Passed! Thanks!
            Hide
            Eloy Lafuente (stronk7) added a comment -

            If there is a will, there is a way, and you found it! Thanks!

            Show
            Eloy Lafuente (stronk7) added a comment - If there is a will, there is a way, and you found it! Thanks!

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: