Moodle
  1. Moodle
  2. MDL-26401

Import Groups from the .csv fails in 2.0.1

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.1
    • Fix Version/s: STABLE backlog
    • Component/s: Groups
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      15995

      Description

      Import Groups from the .csv fails in Moodle 2.0.1+ (Build: 20110209)
      Tested on QA site with the file that works ok in 1.9 (attached)

      Error message:

      Error writing to database

      Debug info:
      Stack trace:

      • line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
      • line 874 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 916 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      • line 135 of /group/lib.php: call to mysqli_native_moodle_database->insert_record()
      • line 171 of /group/import.php: call to groups_create_group()
      1. import.csv
        0.0 kB
        Elena Ivanova

        Activity

        Elena Ivanova created issue -
        Elena Ivanova made changes -
        Field Original Value New Value
        Summary Import Groups from the .csv fails in 2.0 Import Groups from the .csv fails in 2.0.1
        Hide
        Petr Škoda added a comment -

        There is an invalid character at the end of the second line, that is the reason why it fails.

        I agree we should somehow validate the cvs files before storing the data in database....

        Show
        Petr Škoda added a comment - There is an invalid character at the end of the second line, that is the reason why it fails. I agree we should somehow validate the cvs files before storing the data in database....
        Petr Škoda made changes -
        Assignee Petr Škoda (skodak) [ skodak ] moodle.com [ moodle.com ]
        Fix Version/s STABLE backlog [ 10463 ]
        Martin Dougiamas made changes -
        Workflow MDL Workflow [ 67753 ] MDL Full Workflow [ 75873 ]
        Hide
        Jago Brown added a comment -

        feedback:

        on import of utf8 file to mdl 2.2.12 get error:
        15:08:28] Default exception handler: "groupname" is not a valid field name Debug:
        which appears to relate to the Byte Order Mark (BOM) - the representation for the UTF-8 BOM in ISO-8859-1

        http://stackoverflow.com/questions/3255993/how-do-i-remove-i-from-the-beginning-of-a-file

        what works is importing a ANSI encoded file using idnumber instead of (short)coursename

        Show
        Jago Brown added a comment - feedback: on import of utf8 file to mdl 2.2.12 get error: 15:08:28] Default exception handler: "groupname" is not a valid field name Debug: which appears to relate to the Byte Order Mark (BOM) - the representation for the UTF-8 BOM in ISO-8859-1 http://stackoverflow.com/questions/3255993/how-do-i-remove-i-from-the-beginning-of-a-file what works is importing a ANSI encoded file using idnumber instead of (short)coursename
        Hide
        Luis de Vasconcelos added a comment - - edited

        In Moodle 2.5.3+ (Build: 20131129) my group import file contains:

        groupname,description
        group1,testing group 1
        group2,testing group 2
        group3,testing group 3

        When I import that file into a course via http://mysite/group/import.php?id=123 I get the following error:

        "groupname" is not a valid field name

        Debug info:
        Error code: invalidfieldname
        Stack trace:

        line 476 of \lib\setuplib.php: moodle_exception thrown
        line 94 of \group\import.php: call to print_error()

        The Help topic on the /group/import.php?id=123 page says:
        "Required fieldname is groupname"
        so "groupname" has to be valid.

        And line 78/79 of \group\import.php contains:

        // make arrays of valid fields for error checking
        $required = array("groupname" => 1);

        So again, "groupname" seems to be the correct fieldname.

        Why then does Moodle crash with the '"groupname" is not a valid field name' error when clearly "groupname" is the valid field name?

        Show
        Luis de Vasconcelos added a comment - - edited In Moodle 2.5.3+ (Build: 20131129) my group import file contains: groupname,description group1,testing group 1 group2,testing group 2 group3,testing group 3 When I import that file into a course via http://mysite/group/import.php?id=123 I get the following error: "groupname" is not a valid field name Debug info: Error code: invalidfieldname Stack trace: line 476 of \lib\setuplib.php: moodle_exception thrown line 94 of \group\import.php: call to print_error() The Help topic on the /group/import.php?id=123 page says: "Required fieldname is groupname" so "groupname" has to be valid. And line 78/79 of \group\import.php contains: // make arrays of valid fields for error checking $required = array("groupname" => 1); So again, "groupname" seems to be the correct fieldname. Why then does Moodle crash with the '"groupname" is not a valid field name' error when clearly "groupname" is the valid field name?

          People

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

            Dates

            • Created:
              Updated: