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

Export & import report (XML) fails to update all courseid references

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.5.13, 3.8.4
    • Fix Version/s: None
    • Labels:
      None
    • Plugin Version:
      3.8.0
    • Affected Branches:
      MOODLE_35_STABLE, MOODLE_38_STABLE

      Description

      Steps to reproduce:

      1. Export a custom SQL report from the Configurable Reports management page in course A as XML
      2. Import the report into a different course (course B)
      3. Edit the report in course B
      4. Navigate to the Custom SQL tab.
        • Note that the course navigation, breadcrumb trail etc places the context in course B
      5. Make some small change (e.g. add a comment)
      6. Save changes
      7. Observe the course navigation, breadcrumb trail etc. 
        • Expected result: the user remains in the context of course B
        • Actual result: the user has been returned to the context of course A

      This is happening because the table mdl_block_configurable_reports includes the courseid in two places. One is the courseid field itself. The other is the components field which contains a string of key/value pairs. One of these keys is courseid. When the report XML is imported into the new course, the database field courseid for the new record is correctly set to course B, but the courseid reference embedded within the components field remains at the original value (course A). This value is used by the block in a small number of places, including the redirect after saving changes to a report, resulting in the unexpected navigation path described.

      The risk is that the user will get confused about which course they are in, make a purposeful edit to a newly imported report, and accidentally edit the wrong instance of the report in its original course context.

      I imagine that the solution would be to update the courseid reference in the components field as part of the report import process, but I can't at present see quite how to make that work with a robust solution.

        Attachments

          Activity

            People

            Assignee:
            jleyva Juan Leyva
            Reporter:
            ericabithell Erica Bithell
            Participants:
            Component watchers:
            Juan Leyva, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: