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

Manual enrolment via JavaScript doesn't work

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              abias 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
              abias 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
              abias 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
              abias 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
              abias 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
              abias 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
              skodak Petr Skoda added a comment -

              Thanks for the report and proposed patch.

              Show
              skodak Petr Skoda added a comment - Thanks for the report and proposed patch.
              Hide
              samhemelryk 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
              samhemelryk 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_frenz Ankit Agarwal added a comment -

              working as described.
              Thanks

              Show
              ankit_frenz Ankit Agarwal added a comment - working as described. Thanks
              Hide
              stronk7 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
              stronk7 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:
                    Fix Release Date:
                    14/May/12