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

Fatal errors when trying to create an action calendar event outside of the module

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.3
    • Component/s: Calendar
    • Labels:
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull Master Branch:
      wip-MDL-58867-master
    • Testing Instructions:
      Hide

      Pick only the second commit from branch https://github.com/moodle/moodle/compare/master...marinaglancy:wip-MDL-58867-test
      This creates a "Middle of the course" calendar event for the courses in "Weeks" format.

      1. As a teacher create or edit course in the 'Weeks' format so it is a current course (has started but not yet finished). Create/edit event will trigger creating of the calendar event
      2. As a student enrolled in this course make sure you can see "Middle of the course" in the calendar
      3. Go to the dashboard, you won't see this event but at least there will be no fatal errors or weird popups and you will be able to see all other events

      Pick the third commit from the same branch

      1. As a student go to your Dashboard, you should be able to see the "Middle of the course"
        The link "Go learn!" is only displayed if you are in the first half of the course and the event is not actionable if you are in the second half.
      Show
      Pick only the second commit from branch https://github.com/moodle/moodle/compare/master...marinaglancy:wip-MDL-58867-test This creates a "Middle of the course" calendar event for the courses in "Weeks" format. As a teacher create or edit course in the 'Weeks' format so it is a current course (has started but not yet finished). Create/edit event will trigger creating of the calendar event As a student enrolled in this course make sure you can see "Middle of the course" in the calendar Go to the dashboard, you won't see this event but at least there will be no fatal errors or weird popups and you will be able to see all other events Pick the third commit from the same branch As a student go to your Dashboard, you should be able to see the "Middle of the course" The link "Go learn!" is only displayed if you are in the first half of the course and the event is not actionable if you are in the second half.

      Description

      Displaying action calendar events for dashboard is currently only supported for the modules.

      However there is already some code that checks if modulename is empty or not and performs different logic if it is empty.

      If plugin defines an action event on the course level and specifies timesort, there are no errors/warnings while creating an event. When trying to view dashboard the "undefined" popups show up or there are fatal errors. When digging deeper one can find fatal PHP errors that terminate the script execution and WS calls return empty result.
      I'm submitting a patch that at least avoids the fatal errors for the plugin devs who will try to do the same.

      To reproduce:

      1. pick only the second commit from https://github.com/moodle/moodle/compare/master...marinaglancy:wip-MDL-58867-test
      2. create or edit a course in "Weeks" format
      3. login as a student - you will see fatal errors on the dashboard and when viewing calendar
      4. if you change the type of the event in the code from CALENDAR_EVENT_TYPE_ACTION to CALENDAR_EVENT_TYPE_STANDARD and then edit the course again and save (so that calendar event is updated) there will be no errors for student.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marina Marina Glancy
              Reporter:
              marina Marina Glancy
              Peer reviewer:
              cameron1729 cameron1729
              Integrator:
              Dan Poltawski Dan Poltawski
              Tester:
              John Okely John Okely
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/May/17