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

Error "Can't find data record in database table groups" when restoring activity to the other site using group custom field.

XMLWordPrintable

    • MOODLE_403_STABLE, MOODLE_404_STABLE, MOODLE_405_STABLE
    • MOODLE_403_STABLE, MOODLE_404_STABLE
    • MDL-82220-403
    • MDL-82220-404
    • Hide

      Test custom fields export

      1. Log in as admin
      2. Navigate to Courses > Group custom fields in site administration
      3. Create a new category (if none exists)
      4. Create a new Checkbox custom field:
        • Name: Groups checkbox
        • Short name: groupscheckbox
      5. Navigate to Courses > Grouping custom fields in site administration
      6. Create a new category (if none exists)
      7. Create a new Checkbox custom field:
        • Name: Groupings checkbox
        • Short name: groupingscheckbox
      8. Create a new course
      9. Navigate to Participants > Groups
      10. Create a new group
        • Group name: Group 1
        • Groups checkbox: 1 (ticked)
      11. Navigate to Participants > Groupings
      12. Create a new grouping
        • Grouping name: Grouping 1
        • Groupings checkbox: 1 (ticked)
      13. Navigate to More > Course reuse > Backup from course navigation
      14. Leave everything default and press Jump to final step
      15. Wait for backup to complete (may require cron)
      16. Download the backup file
      17. Open the groups.xml file within the downloaded archive
      18. Confirm presence of <groupcustomfields> parent element, containing child element with shortname "groupscheckbox"
      19. Confirm presence of <groupingcustomfields> parent element, containing child element with shortname "groupingscheckbox"
      20. Navigate back to course page
      21. Add an assignment activity
      22. Navigate to More > Backup from assignment navigation
      23. Leave everything default and press Jump to final step
      24. Wait for backup to complete (may require cron)
      25. Download the backup file
      26. Open the groups.xml file within the downloaded archive
      27. Confirm presence of <groupcustomfields> parent element, and that it is empty
      28. Confirm presence of <groupingcustomfields> parent element, and that it is empty

      Test custom fields import

      1. You must test this with a separate site/instance, to ensure prior database IDs are not duplicated/present
      2. Log in as admin
      3. Navigate to Courses > Backups > Asynchronous backup/restore from site administration
      4. Uncheck Enable asynchronous backups and save
      5. Also allow admin conflict resolution
      6. Create a new course
      7. Navigate to More > Course reuse > Course reuse from course navigation
      8. Upload activity-backup.tar.gz and press Restore
      9. Complete restore wizard into current course, leaving everything as default
      10. Confirm the restore process completes successfully without exceptions
      11. Navigate to Courses > Group custom fields in site administration
      12. Create a new category (if none exists)
      13. Create a new Checkbox custom field:
        • Name: Groups checkbox
        • Short name: groupscheckbox
      14. Navigate to Courses > Grouping custom fields in site administration
      15. Create a new category (if none exists)
      16. Create a new Checkbox custom field:
        • Name: Groupings checkbox
        • Short name: groupingscheckbox
      17. Create another new course
      18. Navigate to More > Course reuse > Course reuse from course navigation
      19. Upload course-backup.tar.gz and press Restore
      20. Complete restore wizard into current course, leaving everything as default
      21. Upon completion, navigate to Participants > Groups in course navigation
      22. Select Group 1 and press Edit group settings
      23. Confirm Groups checkbox is checked
      24. Navigate to Participants > Groupings in course navigation
      25. Press Edit for Grouping 1
      26. Confirm Groupings checkbox is checked
      Show
      Test custom fields export Log in as admin Navigate to Courses > Group custom fields in site administration Create a new category (if none exists) Create a new Checkbox custom field: Name: Groups checkbox Short name: groupscheckbox Navigate to Courses > Grouping custom fields in site administration Create a new category (if none exists) Create a new Checkbox custom field: Name: Groupings checkbox Short name: groupingscheckbox Create a new course Navigate to Participants > Groups Create a new group Group name: Group 1 Groups checkbox: 1 (ticked) Navigate to Participants > Groupings Create a new grouping Grouping name: Grouping 1 Groupings checkbox: 1 (ticked) Navigate to More > Course reuse > Backup from course navigation Leave everything default and press Jump to final step Wait for backup to complete (may require cron) Download the backup file Open the groups.xml file within the downloaded archive Confirm presence of <groupcustomfields> parent element, containing child element with shortname "groupscheckbox" Confirm presence of <groupingcustomfields> parent element, containing child element with shortname "groupingscheckbox" Navigate back to course page Add an assignment activity Navigate to More > Backup from assignment navigation Leave everything default and press Jump to final step Wait for backup to complete (may require cron) Download the backup file Open the groups.xml file within the downloaded archive Confirm presence of <groupcustomfields> parent element, and that it is empty Confirm presence of <groupingcustomfields> parent element, and that it is empty Test custom fields import You must test this with a separate site/instance, to ensure prior database IDs are not duplicated/present Log in as admin Navigate to Courses > Backups > Asynchronous backup/restore from site administration Uncheck Enable asynchronous backups and save Also allow admin conflict resolution Create a new course Navigate to More > Course reuse > Course reuse from course navigation Upload activity-backup.tar.gz and press Restore Complete restore wizard into current course, leaving everything as default Confirm the restore process completes successfully without exceptions Navigate to Courses > Group custom fields in site administration Create a new category (if none exists) Create a new Checkbox custom field: Name: Groups checkbox Short name: groupscheckbox Navigate to Courses > Grouping custom fields in site administration Create a new category (if none exists) Create a new Checkbox custom field: Name: Groupings checkbox Short name: groupingscheckbox Create another new course Navigate to More > Course reuse > Course reuse from course navigation Upload course-backup.tar.gz and press Restore Complete restore wizard into current course, leaving everything as default Upon completion, navigate to Participants > Groups in course navigation Select Group 1 and press Edit group settings Confirm Groups checkbox is checked Navigate to Participants > Groupings in course navigation Press Edit for Grouping 1 Confirm Groupings checkbox is checked

      Steps to reproduce

      1. Create and set up a moodle site.
      2. Login as admin.
      3. Go to Site administration > Course > Groups > Group custom fields.
      4. Add a category and create a custom field (I created an optional checkbox).
      5. Create a course.
      6. Add a group.
      7. Create an activity (for instance, an assignment).
      8. Create a backup for the activity and download the backup file.
      9. Create and set up another moodle site.
      10. Create a course.
      11. Restore the activity from backup file
      12. The error is shown below:

      Can't find data record in database table groups.

      Can't find data record in database table groups.
       
      More information about this error
      Debug info: SELECT * FROM {groups} WHERE id = ?
      [array (
      0 => 1,
      )]
      Error code: invalidrecord
      Stack trace:
       
          line 1662 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
          line 1638 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
          line 126 of /group/classes/customfield/group_handler.php: call to moodle_database->get_record()
          line 170 of /group/classes/customfield/group_handler.php: call to core_group\customfield\group_handler->get_instance_context()
          line 1240 of /backup/moodle2/restore_stepslib.php: call to core_group\customfield\group_handler->restore_instance_data_from_backup()
          line 137 of /backup/util/plan/restore_structure_step.class.php: call to restore_groups_structure_step->process_groupcustomfield()
          line 123 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
          line 178 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
          line 111 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
          line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
          line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
          line 189 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
          line 277 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
          line ? of unknownfile: call to progressive_parser->end_tag()
          line 178 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
          line 157 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
          line 110 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
          line 186 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
          line 191 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
          line 168 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
          line 411 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
          line 219 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
          line 146 of /backup/restore.php: call to restore_ui->execute()
      

      The issue is the backup file has groupcustomfield, but not group.

        1. activity-backup.tar.gz
          5 kB
        2. course-backup.tar.gz
          4 kB
        3. MDL-82220 -1.png
          MDL-82220 -1.png
          478 kB
        4. MDL-82220 - 2.png
          MDL-82220 - 2.png
          441 kB

            pholden Paul Holden
            tomotsuyuki Tomo Tsuyuki
            Tomo Tsuyuki Tomo Tsuyuki
            Ilya Tregubov Ilya Tregubov
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.