Moodle
  1. Moodle
  2. MDL-8196

When im editing or adding lessons, I get the error "Update page: answer record not inserted". I am then sent back to my homepage

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: 1.7.2
    • Component/s: Lesson
    • Labels:
      None
    • Environment:
    • Affected Branches:
      MOODLE_17_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE
    • Rank:
      29291

      Description

      When I edit or add a lesson, I get the following error

      "Update page: answer record not inserted". This is when I try to add a branch table.

      I opened de-bugging mode and it presented me with the following information.

      Error: Invalid context creation request for level "70", instance "".

      Incorrect context parameter "" for has_capability(), object expected! This should be fixed in code.

      Error: Invalid context creation request for level "70", instance "".

      Incorrect context parameter "" for has_capability(), object expected! This should be fixed in code.

      Once I click continue, I get the following,

      Field 'response' doesn't have a default value

      INSERT INTO mdl_lesson_answers ( LESSONID, PAGEID, JUMPTO, FLAGS, TIMECREATED, ANSWER )

      Please help as I can no longer edit or add lessons.

      Thanks

      Michael Kenner

      1. error.JPG
        105 kB
      2. lesson problem.jpg
        64 kB

        Activity

        Hide
        Mark Nielsen added a comment -

        Hi Michael,

        The problem with the INSERT is that the install.xml file does not have a default set for the response field (it did for MySQL though). The code does not set response to blank either so the database is rejecting the insert. I'm not sure which is the culprit (perhaps both). Will plan a fix shortly though.

        Could you tell me where exactly you see the has_capability errors? Or the URL?

        Cheers,
        Mark

        Show
        Mark Nielsen added a comment - Hi Michael, The problem with the INSERT is that the install.xml file does not have a default set for the response field (it did for MySQL though). The code does not set response to blank either so the database is rejecting the insert. I'm not sure which is the culprit (perhaps both). Will plan a fix shortly though. Could you tell me where exactly you see the has_capability errors? Or the URL? Cheers, Mark
        Hide
        Anthony Borrow added a comment -

        This sounds like a the mysql strict mode enforcement behavior. See http://moodle.org/mod/forum/discuss.php?d=62812 or search for mysql strict mode. When MySQL enforces strict mode it will not allow an insert with a null default value. I would recommend testing by switching off strict mode and see if that works. Then I would put in a default value or change it so that it is not a NOT NULL field.

        Show
        Anthony Borrow added a comment - This sounds like a the mysql strict mode enforcement behavior. See http://moodle.org/mod/forum/discuss.php?d=62812 or search for mysql strict mode. When MySQL enforces strict mode it will not allow an insert with a null default value. I would recommend testing by switching off strict mode and see if that works. Then I would put in a default value or change it so that it is not a NOT NULL field.
        Hide
        Michael Kenner added a comment -

        Please see attached file for screenshot. Cheers

        Thanks for looking into this for me

        Show
        Michael Kenner added a comment - Please see attached file for screenshot. Cheers Thanks for looking into this for me
        Hide
        Michael Kenner added a comment -

        This is the screenshot of the problem im encontering

        Show
        Michael Kenner added a comment - This is the screenshot of the problem im encontering
        Hide
        Mark Nielsen added a comment -

        Added this problem as a subtask to MDL-7354

        Here is the subtask: MDL-8351

        Once the above subtask is closed, this problem should be fixed.

        Show
        Mark Nielsen added a comment - Added this problem as a subtask to MDL-7354 Here is the subtask: MDL-8351 Once the above subtask is closed, this problem should be fixed.
        Hide
        Mark Nielsen added a comment -

        OK, so Eloy fixed the database problem. You will have to download Moodle 1.7.1+ to get the fix (Make sure it has been re-built recently).

        Could you provide another screen shot for where ever you see these errors:

        Error: Invalid context creation request for level "70", instance "".
        Incorrect context parameter "" for has_capability(), object expected! This should be fixed in code.

        This is a bad error and I would like to identify where this is happening.

        Cheers,
        Mark

        Show
        Mark Nielsen added a comment - OK, so Eloy fixed the database problem. You will have to download Moodle 1.7.1+ to get the fix (Make sure it has been re-built recently). Could you provide another screen shot for where ever you see these errors: Error: Invalid context creation request for level "70", instance "". Incorrect context parameter "" for has_capability(), object expected! This should be fixed in code. This is a bad error and I would like to identify where this is happening. Cheers, Mark
        Hide
        Michael Kenner added a comment -

        Mark

        This is a screenshot of the error

        Cheers

        Mike

        Show
        Michael Kenner added a comment - Mark This is a screenshot of the error Cheers Mike
        Hide
        Mark Nielsen added a comment -

        Hi Mike,

        Thanks for the screenshot, very helpful. Unfortunately I cannot reproduce those debugging errors. After you upgrade to 1.7.1+ let me know if this problem persists.

        Cheers,
        Mark

        Show
        Mark Nielsen added a comment - Hi Mike, Thanks for the screenshot, very helpful. Unfortunately I cannot reproduce those debugging errors. After you upgrade to 1.7.1+ let me know if this problem persists. Cheers, Mark
        Hide
        Mark Nielsen added a comment -

        Finally found what was causing that has_capability() error. Thanks for the report

        Show
        Mark Nielsen added a comment - Finally found what was causing that has_capability() error. Thanks for the report

          People

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

            Dates

            • Created:
              Updated:
              Resolved: