Moodle
  1. Moodle
  2. MDL-35859

Notice when adding id numbers to calculation

    Details

    • Testing Instructions:
      Hide

      Youll need a course with at least one existing grade item in it.

      Go to the gradebook to the categories and items screen. Add a new grade item (theres a button beneath the categories and items table).

      Once its created click the calculator icon in the new grade item's row.

      In the ID Numbers section enter some names for the existing grade items. For example, firstitem and otherassignment. Check that they save without error.

      Enter a formula using the ID numbers. for example =[[firstitem]]+[[otherassignment]]

      Check that it saves without error. It will complain about an invalid formula if it's not correct.

      Show
      Youll need a course with at least one existing grade item in it. Go to the gradebook to the categories and items screen. Add a new grade item (theres a button beneath the categories and items table). Once its created click the calculator icon in the new grade item's row. In the ID Numbers section enter some names for the existing grade items. For example, firstitem and otherassignment. Check that they save without error. Enter a formula using the ID numbers. for example =[ [firstitem] ]+[ [otherassignment] ] Check that it saves without error. It will complain about an invalid formula if it's not correct.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull 2.4 Branch:
      MDL-35859_idnumber_24
    • Rank:
      44622

      Description

      When adding ID numbers to calculation, it throws a notice in developer mode.

      Invalid array parameter detected in required_param(): idnumbers
      line 605 of /lib/moodlelib.php: call to debugging()
      line 33 of /grade/edit/tree/calculation.php: call to optional_param()

        Issue Links

          Activity

          Hide
          Tõnis Tartes added a comment -

          Adding fix

          Show
          Tõnis Tartes added a comment - Adding fix
          Hide
          Sol García added a comment -

          Hi, i have the same problem. Is there solution?

          Show
          Sol García added a comment - Hi, i have the same problem. Is there solution?
          Hide
          Andrew Davis added a comment -

          The patch doesnt seem to exist so I have removed the patch label.

          Show
          Andrew Davis added a comment - The patch doesnt seem to exist so I have removed the patch label.
          Hide
          Andrew Davis added a comment -

          Adding a fix that seems to do the trick. Putting this up for peer review then I'll backport the fix.

          Show
          Andrew Davis added a comment - Adding a fix that seems to do the trick. Putting this up for peer review then I'll backport the fix.
          Hide
          Sol García added a comment -

          The problem is when I edit the resource after configuring the gradebook. That's when gradebook disappears the resource id.

          Show
          Sol García added a comment - The problem is when I edit the resource after configuring the gradebook. That's when gradebook disappears the resource id.
          Hide
          Adrian Greeve added a comment -

          Hello,

          This is a simple enough fix. Looking further at the code I see that we are using $idnumbers as an array so this should have been using optional_param_array().

          No problems found. Submit for integration when ready.

          Show
          Adrian Greeve added a comment - Hello, This is a simple enough fix. Looking further at the code I see that we are using $idnumbers as an array so this should have been using optional_param_array(). No problems found. Submit for integration when ready.
          Hide
          Sol García added a comment -

          Hi Adrian
          I changed in grade/edit/tree/calculation.php the code: $idnumbers = optional_param('idnumbers', null, PARAM_RAW); by : $idnumbers = optional_param_array('idnumbers', null, PARAM_RAW);, but the problem wasn't resolve.
          Can you help me?
          Thanks

          Show
          Sol García added a comment - Hi Adrian I changed in grade/edit/tree/calculation.php the code: $idnumbers = optional_param('idnumbers', null, PARAM_RAW); by : $idnumbers = optional_param_array('idnumbers', null, PARAM_RAW);, but the problem wasn't resolve. Can you help me? Thanks
          Hide
          Andrew Davis added a comment -

          Sol, I'm not sure what trouble you're having as this seems to resolve the issue for me. I've created 2.3 and 2.4 versions. Putting this up for integration.

          Show
          Andrew Davis added a comment - Sol, I'm not sure what trouble you're having as this seems to resolve the issue for me. I've created 2.3 and 2.4 versions. Putting this up for integration.
          Hide
          Adrian Greeve added a comment -

          Hello Sol,

          I think that perhaps your problem might be unrelated to this issue. This patch is to remove the notice that appears when adding id numbers to grade items in the calculated grade settings. If you could give a more detailed explanation as to what your problem is we can determine if we can help your here, or direct you to create a new issue.

          Thanks.

          Show
          Adrian Greeve added a comment - Hello Sol, I think that perhaps your problem might be unrelated to this issue. This patch is to remove the notice that appears when adding id numbers to grade items in the calculated grade settings. If you could give a more detailed explanation as to what your problem is we can determine if we can help your here, or direct you to create a new issue. Thanks.
          Hide
          Dan Poltawski added a comment -

          This issue was solved for master and 25 with MDL-39609, so this is just for 2.4 and 2.3 now.

          Show
          Dan Poltawski added a comment - This issue was solved for master and 25 with MDL-39609 , so this is just for 2.4 and 2.3 now.
          Hide
          Dan Poltawski added a comment -

          Thanks, i've integrated to 23 and 24

          Show
          Dan Poltawski added a comment - Thanks, i've integrated to 23 and 24
          Hide
          Rajesh Taneja added a comment -

          Thanks for fixing this Andrew,

          Works fine for me.

          Show
          Rajesh Taneja added a comment - Thanks for fixing this Andrew, Works fine for me.
          Hide
          Damyon Wiese added a comment -

          Thanks for your contribution! This issue has been reviewed, integrated, tested and now released to everyone.

          Closing as Fixed!

          Show
          Damyon Wiese added a comment - Thanks for your contribution! This issue has been reviewed, integrated, tested and now released to everyone. Closing as Fixed!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: