Moodle
  1. Moodle
  2. MDL-27457

Manual enrolment via JavaScript doesn't work

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.1.4, 2.2.1
    • Fix Version/s: 2.1.6, 2.2.3
    • Component/s: Enrolments
    • Labels:
    • Environment:
      Client: Firefox 3.6.17 (Mac) or Safari 5.0.3 (Mac)
    • Testing Instructions:
      Hide

      Nothing happens now, instead JavaScript console in Safari and Firefox now says:
      TypeError: Result of expression 'this.get(UEP.BASE).one('#recovergrades')' [null] is not an object.

      Show
      Login as admin Go to http://MYMOODLEPAGE/admin/settings.php?section=cleanup Set preference "disablegradehistory" to yes Go to http://MYMOODLEPAGE/enrol/users.php?id=COURSEID Click "Enrol users" button Select role in "Assign role" select box Choose user to enrol and click "enrol" button Nothing happens now, instead JavaScript console in Safari and Firefox now says: TypeError: Result of expression 'this.get(UEP.BASE).one('#recovergrades')' [null] is not an object.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w11_MDL-27457_m23_enrolnorecover
    • Rank:
      17120

      Description

      Manual enrolment via JavaScript fails when preference "disablegradehistory" is set to yes.
      I think the bug must be in /enrol/yui/enrolmentmanager/enrolmentmanager.js, Line 77. But as I don't know much about YUI yet, I can't provide a patch.

        Issue Links

          Activity

          Hide
          Alexander Bias added a comment -

          I found out that the bug wasn't caused by my moodle update, therefore I corrected the description and the testing instructions.

          Show
          Alexander Bias added a comment - I found out that the bug wasn't caused by my moodle update, therefore I corrected the description and the testing instructions.
          Hide
          Alexander Bias added a comment -

          In Moodle 2.1, /enrol/yui/enrolmentmanager/enrolmentmanager.js has vanished. The code (and with it the bug) seems to have moved to /enrol/manual/yui/quickenrolment/quickenrolment.js

          I checked the code again and I think I found a solution - at least for moodle installations with disablegradehistory set to yes.

          In /enrol/manual/yui/quickenrolment/quickenrolment.js, please replace line 382

          params['recovergrades'] = this.get(UEP.BASE).one('#'+CSS.RECOVERGRADES).get('checked')?1:0;

          with

          if (this.get(UEP.DISABLEGRADEHISTORY) != true)

          { params['recovergrades'] = this.get(UEP.BASE).one('#'+CSS.RECOVERGRADES).get('checked')?1:0; }
          Show
          Alexander Bias added a comment - In Moodle 2.1, /enrol/yui/enrolmentmanager/enrolmentmanager.js has vanished. The code (and with it the bug) seems to have moved to /enrol/manual/yui/quickenrolment/quickenrolment.js I checked the code again and I think I found a solution - at least for moodle installations with disablegradehistory set to yes. In /enrol/manual/yui/quickenrolment/quickenrolment.js, please replace line 382 params ['recovergrades'] = this.get(UEP.BASE).one('#'+CSS.RECOVERGRADES).get('checked')?1:0; with if (this.get(UEP.DISABLEGRADEHISTORY) != true) { params['recovergrades'] = this.get(UEP.BASE).one('#'+CSS.RECOVERGRADES).get('checked')?1:0; }
          Hide
          Alexander Bias added a comment -

          I just verified that the problem is still present in 2.2.x
          I would be grateful if the small patch could be included in moodle core.

          Show
          Alexander Bias added a comment - I just verified that the problem is still present in 2.2.x I would be grateful if the small patch could be included in moodle core.
          Hide
          Petr Škoda added a comment -

          Thanks for the report and proposed patch.

          Show
          Petr Škoda added a comment - Thanks for the report and proposed patch.
          Hide
          Sam Hemelryk added a comment -

          Thanks guys, this has been integrated now. I will shortly open an issue for another bug I found while reviewing this.

          Cheers
          Sam

          Show
          Sam Hemelryk added a comment - Thanks guys, this has been integrated now. I will shortly open an issue for another bug I found while reviewing this. Cheers Sam
          Hide
          Ankit Agarwal added a comment -

          working as described.
          Thanks

          Show
          Ankit Agarwal added a comment - working as described. Thanks
          Hide
          Eloy Lafuente (stronk7) added a comment -

          FCT (fixed, closing, thanks). Ciao

          "I feel a very unusual sensation - if it is not indigestion, I think it must be gratitude!"
          ~ Benjamin Disraeli

          Show
          Eloy Lafuente (stronk7) added a comment - FCT (fixed, closing, thanks). Ciao "I feel a very unusual sensation - if it is not indigestion, I think it must be gratitude!" ~ Benjamin Disraeli

            People

            • Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: