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

Upload users with datetime custom field doesn't validate data

    XMLWordPrintable

Details

    • MOODLE_23_STABLE, MOODLE_24_STABLE
    • MOODLE_25_STABLE
    • wip-mdl-38494
    • Hide

      Testing instructions:

      1. Create custom profile field using datetime format (eg date of birth)
      2. Upload users from CSV with above field included, using YYYY-MM-DD format
      3. Upload succeeds
      4. View uploaded user profiles
        Expected: custom field displays correctly (eg 7 May 1984)
        Actual Result: custom field displays as 1-Jan-1970 (unix time 0)

      After applying patch:

      1. Upload users from CSV with field included.
      2. Upload succeeds
      3. View uploaded user profiles
        Result: custom field displays correctly (eg 7 May 1984)
      Show
      Testing instructions: Create custom profile field using datetime format (eg date of birth) Upload users from CSV with above field included, using YYYY-MM-DD format Upload succeeds View uploaded user profiles Expected: custom field displays correctly (eg 7 May 1984) Actual Result: custom field displays as 1-Jan-1970 (unix time 0) After applying patch: Upload users from CSV with field included. Upload succeeds View uploaded user profiles Result: custom field displays correctly (eg 7 May 1984)

    Description

      When uploading users via csv, custom datetime fields are not validated or converted to the correct format for database storage. The field should be stored as a unix timestamp in the user_info_data table, but is stored as a text string instead.

      My patch adds preprocessing to the datetime profile field type.

      Attachments

        Issue Links

          Activity

            People

              rajeshtaneja Rajesh Taneja
              chrisw Chris Wharton
              Ankit Agarwal Ankit Agarwal
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              David Monllaó David Monllaó
              Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                14/May/13