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

enrol_user() does not use $status param

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: Enrolments
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      enrollib.php : enrol_user() should use its $status param

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              jerome Jérôme Mouneyrac added a comment -

              Not that the fix will have a very weak impact as the only place where $status argument is used is in this backup call:
              backup/moodle2/restore_stepslib.php

              /**
                   * Create user enrolments
                   *
                   * This has to be called after creation of enrolment instances
                   * and before adding of role assignments.
                   *
                   * @param mixed $data
                   * @return void
                   */
                  public function process_enrolment($data) {
                      global $DB;
               
                      $data = (object)$data;
               
                      // Process only if parent instance have been mapped
                      if ($enrolid = $this->get_new_parentid('enrol')) {
                          if ($instance = $DB->get_record('enrol', array('id'=>$enrolid))) {
                              // And only if user is a mapped one
                              if ($userid = $this->get_mappingid('user', $data->userid)) {
                                  $enrol = enrol_get_plugin($instance->enrol);
                                  //TODO: do we need specify modifierid?
                                  $enrol->enrol_user($instance, $userid, null, $data->timestart, $data->timeend, $data->status);
                                  //note: roles are assigned in restore_ras_and_caps_structure_step::process_assignment() processing above
                              }
                          }
                      }
                  }

              Show
              jerome Jérôme Mouneyrac added a comment - Not that the fix will have a very weak impact as the only place where $status argument is used is in this backup call: backup/moodle2/restore_stepslib.php /** * Create user enrolments * * This has to be called after creation of enrolment instances * and before adding of role assignments. * * @param mixed $data * @return void */ public function process_enrolment($data) { global $DB;   $data = (object)$data;   // Process only if parent instance have been mapped if ($enrolid = $this->get_new_parentid('enrol')) { if ($instance = $DB->get_record('enrol', array('id'=>$enrolid))) { // And only if user is a mapped one if ($userid = $this->get_mappingid('user', $data->userid)) { $enrol = enrol_get_plugin($instance->enrol); //TODO: do we need specify modifierid? $enrol->enrol_user($instance, $userid, null, $data->timestart, $data->timeend, $data->status); //note: roles are assigned in restore_ras_and_caps_structure_step::process_assignment() processing above } } } }
              Show
              jerome Jérôme Mouneyrac added a comment - patch: https://github.com/mouneyrac/moodle/commit/d587f077ef87367dc9d69ecfee4320ef0a1bc090
              Hide
              tsala Helen Foster added a comment -

              Thanks Jerome

              Show
              tsala Helen Foster added a comment - Thanks Jerome

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    5/May/11