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

Editing calendar may cause errors on every page with calendar block



    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 3.9.10
    • None
    • Calendar
    • None


      Saving the calendar event to the database seems to include all of the inactive form elements aswell, so the values get overwritten, which results in an error on every page that tries to access a broken event.

      Steps to reproduce:

      Create a course and enrol yourself in it. Create a group inside the course with yourself as a member. Go to your calendar page and add a calendar event of the Group type with the previously created group in the course. Open the event for editing and remove the selected course, keeping the group set. Switch the event type to User and save the event. An error modal should pop up, containing the Invalidrecord error message. The error is from recieving the data, in the database, courseid has been set to 0 while groupid is still set:

      MariaDB [moodle]> select name,categoryid,courseid,groupid,userid,type from mdl_event where userid=2;
      | name                     | categoryid | courseid | groupid | userid | type |
      | errorevent               |          0 |        0 |       3 |      2 |    0 |

      At this point, the event will disappear from the calendar as if it was deleted. If the surprised user decides to add another event with the same name (in this case - "errorevent"), Moodle will add the event, but every time it tries to fetch it from the database, it will grab the first one. As the record contains a valid groupid but not courseid, Moodle will return an error on every calendar instance that would include the event to all members of the group, preventing them from viewing their calendars.


        Issue Links



              Unassigned Unassigned
              tjazbec Timotej Jazbec
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              0 Vote for this issue
              2 Start watching this issue