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

Database event "Record created" is triggered twice

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Login as Admin.
      2. Create a Course.
      3. Create and setup a new Database activity in the Course.
      4. Create a new entry in the Database activity.
      5. Visit the logs (Admin > Reports > Logs).
        • make sure a single entry for the record created event is visible.
      Mobile
      1. Go to "Site administration / Mobile app / Mobile settings" and enable web services for mobile devices. Save the changes
      2. Connect to the moodle site using the moodle mobile app.
      3. Go to the database activity and create a record.
      4. Back on the browser, check the logs.
      5. Confirm that there's a single log entry about the newly created record.
      Show
      Login as Admin. Create a Course. Create and setup a new Database activity in the Course. Create a new entry in the Database activity. Visit the logs (Admin > Reports > Logs). make sure a single entry for the record created event is visible. Mobile Go to " Site administration / Mobile app / Mobile settings " and enable web services for mobile devices. Save the changes Connect to the moodle site using the moodle mobile app. Go to the database activity and create a record. Back on the browser, check the logs. Confirm that there's a single log entry about the newly created record.
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE
    • Pull 3.6 Branch:
    • Pull 3.7 Branch:
    • Pull Master Branch:
      MDL-65507-master

      Description

      The event \mod_data\event\record_created is triggered twice when a new record is created. This seems to be a regression introduced in Moodle 3.3, when the function data_add_fields_contents_to_new_record was introduced.

      Replication steps:

      1. Create and setup a new database activity
      2. Create a new entry
      3. Visit the logs (Admin > Reports > Logs)

      Expected:

      • A single entry for the record created event is visible

      Actual:

      • The logs display two entries for the same record created

      The problem seems to stem from the use of both data_add_record and data_add_fields_contents_to_new_record in edit.php.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Sep/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 33 minutes
                  2h 33m