Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-4945

Errors in course without teacher (Can't drop appointments)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.7
    • Component/s: Module: Scheduler
    • Labels:
      None
    • Plugin Version:
      2.5.1 (2013092702)
    • Workaround:
      Hide

      Give at least one user the "teacher" role in the course.

      Show
      Give at least one user the "teacher" role in the course.
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE

      Description

      N.B. the following occurs in a course that doesn't have a teacher assigned.


      The issues I am having here include:

      • Unexpected error messages.
      • Unable to drop previously created appointments as a student.
      • Irrelevant information on "Drop an appointment" screen.

      Here are the step-by-step details on exactly how to reproduce these issues along with the error messages that appeared during the process:

      Install Moodle 2.6 on Windows (Apache/MySQL).
      Download latest version of Scheduler plugin from https://moodle.org/plugins/pluginversions.php?plugin=mod_scheduler
      Unzip the contents into the /mod/ folder.
      Log in as administrator.
      Click Upgrade database on the notifications page.
      Click Continue.
      Click Save Changes button to save default scheduler settings (nothing changed).

      Click Site Administration > Development > Debugging.
      Set the "Debug Messages" field to "DEVELOPER".
      Ensure that "Display debug messages" checkbox is checked.
      Click the "Save Changes" button.

      Click Site Administration > Development > Make a test course
      Set the size of course to XS and Course short name to "TESTCOURSE"
      Click "Create course" button.
      Click Continue link after course is created.

      Click Course administration > Turn editing on
      Under "Topic 1", click "Add an activity or resource".
      Select Scheduler and click Add button.
      Enter the following information:

      • Name: Scheduler Test Activity
        Click Save and display.
        Click "Add slots" button.
        Change the "Repeat Time Slot Until" field to be at least 3 days in the future. (just in case you are working on the weekend)
        Change the end-time to one hour after the start time.
        Click Save Changes

      ==================================
      Error to be fixed!
      ----------------------------------
      I expected to not see any errors here. Notice however that you get one or more of each of the the following PHP error notices at the top of the page:

      Notice: Undefined property: stdClass::$teacherid in /moodle/mod/scheduler/teacherview.controller.php on line 30
      Notice: Undefined property: stdClass::$teacherid in /moodle/mod/scheduler/teacherview.controller.php on line 69

      If it failed to create a slot, you will only see the first error.

      ==================================

      Click Site Administration > Users > Accounts > Browse list of users
      Click the Edit gear for "Test course user 1"
      Set the New Password field to "TestUser1!"
      Click Update profile.
      Click "Log out"

      Click "Log in"

      • Username: tool_generator_000001
      • Password: TestUser1!
        Click "My courses"
        Click "TESTCOURSE"
        Click "Scheduler Test Activity"
        Select the second appointment in the list. (it could be any but you need to remember which one you choose).
        Click "Save my choice"

      ==================================
      Error to be fixed!
      ----------------------------------
      I expected to not see any errors here. Notice however that you get the following error message at the top of the page:

      Error writing to database

      More information about this error
      Debug info: Column 'userid' cannot be null
      INSERT INTO mdl_event (name,description,format,userid,instance,timemodified,timestart,timeduration,visible,eventtype) VALUES(?,?,?,?,?,?,?,?,?,?)
      [array (
      0 => 'Meeting with your Student, Test course user 1',
      1 => 'Scheduler Test Activity<br/><br/>',
      2 => 1,
      3 => NULL,
      4 => '1',
      5 => 1395425663,
      6 => '1395634500',
      7 => 900,
      8 => 1,
      9 => 'SSsup:6:2',
      )]
      Error code: dmlwriteexception
      Stack trace:

      line 444 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 1080 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 1122 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      line 569 of /mod/scheduler/locallib.php: call to mysqli_native_moodle_database->insert_record()
      line 617 of /mod/scheduler/locallib.php: call to scheduler_add_update_calendar_events()
      line 143 of /mod/scheduler/studentview.controller.php: call to scheduler_events_update()
      line 14 of /mod/scheduler/studentview.php: call to require_once()
      line 119 of /mod/scheduler/view.php: call to include()

      ==================================

      Click the continue button.
      Notice that we've been kicked back to the site's Front page. I didn't expect that.

      Click "My courses"
      Click "TESTCOURSE"
      Click "Scheduler Test Activity"
      Despite the error messages so far, notice that our appointment appears to have been saved.

      Click the Drop my appointments link at the bottom of the page.
      Notice that this page looks just like the previous one. There is no indication that we are about to drop an appointment.
      Notice that, even though you've booked the second appointment in the list, it still says that space is limited and that there is 1/1 spot left.
      Notice that there are no choices selected. Hope you remembered what timeslot you want to drop.
      Click the second radio button in the list and click the "Save my choice" button.

      ==================================
      Error to be fixed!
      ----------------------------------
      I expected to not see any errors here. Notice however, once again, we see the following error message:

      Error writing to database

      More information about this error
      Debug info: Column 'userid' cannot be null
      INSERT INTO mdl_event (name,description,format,userid,instance,timemodified,timestart,timeduration,visible,eventtype) VALUES(?,?,?,?,?,?,?,?,?,?)
      [array (
      0 => 'Meeting with your Student, Test course user 1',
      1 => 'Scheduler Test Activity<br/><br/>',
      2 => 1,
      3 => NULL,
      4 => '1',
      5 => 1395426178,
      6 => '1395634500',
      7 => 900,
      8 => 1,
      9 => 'SSsup:6:2',
      )]
      Error code: dmlwriteexception
      Stack trace:

      line 444 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 1080 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 1122 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      line 569 of /mod/scheduler/locallib.php: call to mysqli_native_moodle_database->insert_record()
      line 617 of /mod/scheduler/locallib.php: call to scheduler_add_update_calendar_events()
      line 143 of /mod/scheduler/studentview.controller.php: call to scheduler_events_update()
      line 14 of /mod/scheduler/studentview.php: call to require_once()
      line 119 of /mod/scheduler/view.php: call to include()

      ==================================

      Click the Continue button.
      Notice that we've been kicked back to the site's Front page once again. I didn't expect that but am starting to get used to it.

      Click "My courses"
      Click "TESTCOURSE"
      Click "Scheduler Test Activity"

      Notice that our appointment is still booked. I expected my appointment to no longer be booked.

      Feel free to contact me if you have any questions.

      Best regards,

      Michael

        Attachments

          Activity

            People

            Assignee:
            bostelm Henning Bostelmann
            Reporter:
            michael-milette Michael Milette
            Participants:
            Component watchers:
            Valery Fremaux
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              12/May/14