Moodle
  1. Moodle
  2. MDL-36331

grade.php redirecting to the wrong place

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.2.7, 2.3.4
    • Component/s: Gradebook
    • Labels:
    • Testing Instructions:
      Hide

      Go to the gradebook.

      Go to the grader report and turn on editing.
      Click the edit icon for an individual student's grade.
      Click cancel and check that you're redirected without error.
      Click the edit icon again and alter the student's grade.

      Go to the categories and items screen.
      Create a new grade item (theres a "add grade item" button towards the bottom of the page)
      Click the calculator icon next to the new grade item.
      Click cancel and check you dont get an error.
      Click the calculator again and set up a calculation. http://docs.moodle.org/20/en/Grade_calculations

      Show
      Go to the gradebook. Go to the grader report and turn on editing. Click the edit icon for an individual student's grade. Click cancel and check that you're redirected without error. Click the edit icon again and alter the student's grade. Go to the categories and items screen. Create a new grade item (theres a "add grade item" button towards the bottom of the page) Click the calculator icon next to the new grade item. Click cancel and check you dont get an error. Click the calculator again and set up a calculation. http://docs.moodle.org/20/en/Grade_calculations
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-36331_redirect
    • Rank:
      45125

      Description

      Hi,

      I'm not a general Moodle and this isn't my normal role user so please excuse me and accept my apologies if this is my own fault... however I am currently covering our vacant e-learning position and hence am investigating any problems reported.

      One of our users told me that they were receiving a 404 error when editing some grades within our moodle.

      The errors were logged as:

      [31/Oct/2012:14:26:39 +0000] "GET /grade/report.php?id=34 HTTP/1.1" 404 509
      

      And then in the error log:

      script '/var/www/sites/festudio/moodle/grade/report.php' not found or unable to stat, referer: http:// ... /grade/edit/tree/grade.php?courseid=34&itemid=37&userid=485
      

      Within the moodle/grade/edit/tree/grade.php file (and I have checked this on a new download), lines 58-60 are:

      // default return url
      $gpr = new grade_plugin_return();
      $returnurl = $gpr->get_return_url($CFG->wwwroot.'/grade/report.php?id='.$course->id);
      

      However the file /grade/report.php does not exist, it also doesn't exist in the fresh installation that I downloaded so I have checked that it hasn't simply been deleted.

      I am wondering if the line should read:

      $returnurl = $gpr->get_return_url($CFG->wwwroot.'/grade/report/index.php?id='.$course->id);
      

        Activity

        Hide
        Michael de Raadt added a comment -

        Thanks for spotting that and proposing a fix.

        It would be great if we could get a set of reproduction steps.

        Show
        Michael de Raadt added a comment - Thanks for spotting that and proposing a fix. It would be great if we could get a set of reproduction steps.
        Hide
        Ian Atkinson added a comment -

        Hi Michael,

        The $returnurl seems to be called on form cancellation so the quickest way I tested it was to go into a grade editing screen e.g.

        http:// [site] /grade/edit/tree/grade.php?courseid=34&itemid=37&userid=485

        and then press the cancel button (next to the save changes button)

        By the way if this is a bug that needs addressing the same line of code is also found in /moodle/grade/edit/tree/calculation.php so it presumably needs changing there also,

        Ian

        Show
        Ian Atkinson added a comment - Hi Michael, The $returnurl seems to be called on form cancellation so the quickest way I tested it was to go into a grade editing screen e.g. http:// [site] /grade/edit/tree/grade.php?courseid=34&itemid=37&userid=485 and then press the cancel button (next to the save changes button) By the way if this is a bug that needs addressing the same line of code is also found in /moodle/grade/edit/tree/calculation.php so it presumably needs changing there also, Ian
        Hide
        Michael de Raadt added a comment -

        Thanks, Ian.

        It looks like Andrew has this issue in his sights.

        Show
        Michael de Raadt added a comment - Thanks, Ian. It looks like Andrew has this issue in his sights.
        Hide
        Andrew Davis added a comment -

        Thanks for the bug report Ian. I've added a solution and some testing instructions.

        Show
        Andrew Davis added a comment - Thanks for the bug report Ian. I've added a solution and some testing instructions.
        Hide
        Adrian Greeve added a comment -

        [Y] Syntax
        [-] Output
        [Y] Whitespace
        [-] Language
        [-] Databases
        [Y] Testing
        [-] Security
        [-] Documentation
        [Y] Git
        [Y] Sanity check

        Hello Andrew. I see no problems here.

        Thanks.

        Show
        Adrian Greeve added a comment - [Y] Syntax [-] Output [Y] Whitespace [-] Language [-] Databases [Y] Testing [-] Security [-] Documentation [Y] Git [Y] Sanity check Hello Andrew. I see no problems here. Thanks.
        Hide
        Andrew Davis added a comment -

        Adding 2.2 and 2.3 versions and putting up for integration.

        Show
        Andrew Davis added a comment - Adding 2.2 and 2.3 versions and putting up for integration.
        Hide
        Dan Poltawski added a comment -

        Thanks Andrew, i've integrated this now

        Show
        Dan Poltawski added a comment - Thanks Andrew, i've integrated this now
        Hide
        Dan Poltawski added a comment -

        Oops, failed hte wrong issue

        Show
        Dan Poltawski added a comment - Oops, failed hte wrong issue
        Hide
        Andrew Davis added a comment -

        I was wondering how on earth this fix could have possibly broken anything

        Show
        Andrew Davis added a comment - I was wondering how on earth this fix could have possibly broken anything
        Hide
        Mark Nelson added a comment -

        Works as expected.

        Show
        Mark Nelson added a comment - Works as expected.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Many, many thanks for your effort!

        Millions of people will enjoy the results of your work, yay!

        Closing as fixed. Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Many, many thanks for your effort! Millions of people will enjoy the results of your work, yay! Closing as fixed. Ciao

          People

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

            Dates

            • Created:
              Updated:
              Resolved: