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

MRBS - cannot create a repeating entry due to timestamp error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Not a bug
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Block: Mrbs
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      Dave - I received a report from a user that they were having trouble creating a repeating entry. I was able to replicate the error and tracked it down but not sure how best to resolve it and figured I would check with you to see which is the easiest/desired approach.

      The issue has to do with the timestamp field in the mrbs_repeat table. In the database this is defined as a timestamp field and intended to be automatically updated. This is usually not the Moodle way of doing things and may make the MRBS block more limited in terms of databases that it will run on but I'm OK with it being that way for now. In any case in blocks/mrbs/web/mrbs_sql.php in the mrbsCreateRepeatEntry (and I noticed the same in single entry) we are setting:

      $add->timestamp = time();

      which populates it with the current time as a unix_timestamp. This value is rejected. Now that I have thought about it - I went in and looked at what the field is intended to be according to the blocks/mrbs/db/install.xml file and it is an unsigned it like the other fields. I'm thinking someone may have changed it on the site and when we upgraded the site it maintained the table as it was previously. I am going to change it in this database which was having problems and see if that resolves the issue and then we can resolve this as not a bug. I'll go ahead and leave the issue in the tracker since I have done this much typing and investigation already in case others run into a similar situation.

      Peace - Anthony

      Error writing to database

      More information about this error
      Debug info: Incorrect datetime value: '1312737591' for column 'timestamp' at row 1
      INSERT INTO mdl_mrbs_repeat (start_time,end_time,rep_type,end_date,room_id,create_by,type,name,timestamp,rep_opt,description) VALUES(?,?,?,?,?,?,?,?,?,?,?)
      [array (
      0 => 1314378420,
      1 => 1314378480,
      2 => 2,
      3 => 1326478020,
      4 => 5,
      5 => 'mtrost',
      6 => 'I',
      7 => 'mtrost',
      8 => 1312737591,
      9 => '0000000',
      10 => 'Class',
      )]
      Stack trace:

      line 397 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 878 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 920 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      line 242 of /blocks/mrbs/web/mrbs_sql.php: call to mysqli_native_moodle_database->insert_record()
      line 427 of /blocks/mrbs/web/mrbs_sql.php: call to mrbsCreateRepeatEntry()
      line 310 of /blocks/mrbs/web/edit_entry_handler.php: call to mrbsCreateRepeatingEntrys()

        Attachments

          Activity

            People

            Assignee:
            aborrow Anthony Borrow
            Reporter:
            aborrow Anthony Borrow
            Participants:
            Component watchers:
            Davo Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              24/Nov/10