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

Improve enrol plugins to better handle its unique/multiple property

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 2.0, 2.1.1, 2.2
    • Enrolments
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE

      When working on MDL-26841, I detected one inconsistency/missing feature in the enrollment api: It seems that the detection/permission to create multiple instances is somehow incomplete. So for example:

      • In one course already having one "guest" plugin, the get_newinstance_link() method properly detects it and avoids to return one link to create a new instance.
      • But in the same course, the add_instance() method does not detect it and creates one new instance without problems.

      So, I think we should implement/extend the API to:

      1) Define, for each enrol plugin, if multiple instances are allowed for a given context. And provide public getter for that.
      2) Define another method, ideally public too, to perform all the checks necessary to detect if one new instance can be added (returns true/false).
      3) Optional: make add_instance() to use 1 & 2 above and return null if the instance was not created (there are code relying on this right now).

      That is, for your consideration. Surely we should offer BC defaults to current behavior and perhaps it's one new feature/bugfix so I'd consider backporting it to 21_STABLE.

      Ciao

            skodak Petr Skoda
            stronk7 Eloy Lafuente (stronk7)
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.