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

Database enrolment doesn't unenrol LAST user from course when unenrol action is set to do so

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Enrolments
    • Labels:
    • Testing Instructions:
      Hide

      1/ set up ext db enrolment with "full unenrolment" action
      2/ add some users to external db and sync
      3/ remove ALL users from ext db
      4/ sync - expected warning message explaining that there MUST be at least one user in ext DB

      previously this warning was only in verbose mode

      Show
      1/ set up ext db enrolment with "full unenrolment" action 2/ add some users to external db and sync 3/ remove ALL users from ext db 4/ sync - expected warning message explaining that there MUST be at least one user in ext DB previously this warning was only in verbose mode
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w12_MDL-32046_m23_lastdbuser

      Description

      1/ setup the external database enrolment plugin to enrol against a db table and enable the plugin.
      I created the following table in my moodle install:

      mysql> select * from xx_enrol_danp;
      +----------+--------+---------+
      | courseid | userid | role    |
      +----------+--------+---------+
      |      2   |      4 | student |
      +----------+--------+---------+
      1 row in set (0.00 sec)
      

      2/ Set the 'External unenrol action' to 'Unenrol user from course'
      2/ run enrol/database/cli/sync.php
      3/ Confirm user 4 is enrolled in courseid 2
      4/ Delete the enrollment from external db:

      mysql> delete from xx_enrol_danp where course = 2;
      Query OK, 0 rows affected (0.00 sec)
      mysql> select * from xx_enrol_danp;
      Empty set (0.00 sec)
      

      4/ Run enrol/database/cli/sync.php again

      Expected result
      ================

      • User is unenrolled from course

      Actual Result
      =============
      User is still enrolled and enrollment is unaffected

      Note: If unernol action is set to disable enrolment this works ok

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    25/Jun/12