Skip to content

Commit

Permalink
Merge branch 'MDL-72432-master' of https://github.com/katerynadegtyar…
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Sep 15, 2021
2 parents f1416b6 + b25e173 commit c60ea2c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions group/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@
$text = $importform->get_file_content('userfile');
$text = preg_replace('!\r\n?!', "\n", $text);

$rawlines = explode("\n", $text);

require_once($CFG->libdir . '/csvlib.class.php');
$importid = csv_import_reader::get_new_iid('groupimport');
$csvimport = new csv_import_reader($importid, 'groupimport');
Expand Down Expand Up @@ -95,7 +93,9 @@
);

// --- get header (field names) ---
$header = explode($csvimport::get_delimiter($delimiter), array_shift($rawlines));
// Using get_columns() ensures the Byte Order Mark is removed.
$header = $csvimport->get_columns();

// check for valid field names
foreach ($header as $i => $h) {
$h = trim($h); $header[$i] = $h; // remove whitespace
Expand Down

0 comments on commit c60ea2c

Please sign in to comment.