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

Upload users import parses CSV records with varying number of fields strangely.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.9
    • 1.8.1
    • Authentication, Enrolments
    • None
    • MOODLE_18_STABLE
    • MOODLE_19_STABLE

      Excel sometimes generates CSV files where some rows have less fields than others when the last fields on a row are empty.

      e.g.:
      username,course1,role1,course2,role2
      userid1,CF01,5,CF02,3
      userid2,CF05,5

      If the above file is uploaded then moodle fills in the missing fields in the 'userid2' row with CF02,3 from the row above.
      Better handling would be to assume those fields are blank.

      Caused by failure to clear $record variable between processing lines of CSV file.

      Solution is to add "unset($record);" on line 359 of admin/uploaduser.php (just after unset($user); ):

            skodak Petr Skoda
            antgreen Anthony Green (Inactive)
            Nobody Nobody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

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