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

Create an import preview for importing entries into the database activity.

    Details

    • Testing Instructions:
      Hide
      1. Either create or use an existing database activity.
      2. To easily prepare a file for import, first export the current entries (enter some data if you created a fresh activity).
      3. Delete the data (but keep the headings) and create new data.
      4. Import the new file. [Settings ► Database activity administration ► Import entries].
      5. Submitting the form should take you to a preview page.
        • Check that there is a 'Field mappings' section and that the field names in the select box defaults to the field name text.
      6. Click submit.
        • Ensure that the entries are correctly entered into the database.
      7. Go back to the import section and load another file (or the same file).
      8. Click Submit. You should be back at the preview screen. Click 'Cancel'.
        • Make sure that you are redirected back to the database activity.
      9. This time create a file, but use different headings for the fields.
      10. Import this file and map the headings to the correct fields.
        • Ensure that the entries import properly.
      Show
      Either create or use an existing database activity. To easily prepare a file for import, first export the current entries (enter some data if you created a fresh activity). Delete the data (but keep the headings) and create new data. Import the new file. [Settings ► Database activity administration ► Import entries] . Submitting the form should take you to a preview page. Check that there is a 'Field mappings' section and that the field names in the select box defaults to the field name text. Click submit. Ensure that the entries are correctly entered into the database. Go back to the import section and load another file (or the same file). Click Submit. You should be back at the preview screen. Click 'Cancel'. Make sure that you are redirected back to the database activity. This time create a file, but use different headings for the fields. Import this file and map the headings to the correct fields. Ensure that the entries import properly.
    • Affected Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-37503-master

      Description

      Currently there is no preview page when importing entries into the database activity.
      Most other areas of moodle provide this.
      It is proposed that field handling be incorporated into this preview page.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              rajeshtaneja Rajesh Taneja added a comment -

              Thanks for fixing this Adrian,

              Few minor issues which you might want to consider:

              1. #L0R101 and #L0R102 is intentional ? Shouldn't it be print_error ?
              2. #L0R107 will give php warning if csv is empty and no headers found.
              3. #L0R166 can we have $PAGE settings to be done outside if statements to avoid recurring logic.
              4. #L1R22 mod-data should be mod_data
              5. While you are refactoring so much it might be nice to replace #L1R24 with defined('MOODLE_INTERNAL') || die();
              6. mod_data_import_form2 can be name mod_data_import_mapping_form or something else.

              In all patch looks good, but IMHO it will be nice if you can retractor the patch to simplify the logic. Currently, it is very confusing to see if $iid is empty then it do some processing and then again raise_memory_limit and create csv_import_reader.

              Show
              rajeshtaneja Rajesh Taneja added a comment - Thanks for fixing this Adrian, Few minor issues which you might want to consider: #L0R101 and #L0R102 is intentional ? Shouldn't it be print_error ? #L0R107 will give php warning if csv is empty and no headers found. #L0R166 can we have $PAGE settings to be done outside if statements to avoid recurring logic. #L1R22 mod-data should be mod_data While you are refactoring so much it might be nice to replace #L1R24 with defined('MOODLE_INTERNAL') || die(); mod_data_import_form2 can be name mod_data_import_mapping_form or something else. In all patch looks good, but IMHO it will be nice if you can retractor the patch to simplify the logic. Currently, it is very confusing to see if $iid is empty then it do some processing and then again raise_memory_limit and create csv_import_reader.
              Hide
              abgreeve Adrian Greeve added a comment -

              I am un-assigning myself from this issue as I am not currently working on this and it will give the opportunity for someone else to work on it.

              Show
              abgreeve Adrian Greeve added a comment - I am un-assigning myself from this issue as I am not currently working on this and it will give the opportunity for someone else to work on it.

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated: