Skip to content

Commit

Permalink
Merge branch 'w26_MDL-40254_m25_flatfile' of https://github.com/skoda…
Browse files Browse the repository at this point in the history
…k/moodle into MOODLE_25_STABLE
  • Loading branch information
stronk7 committed Jun 24, 2013
2 parents 9067595 + 55384d2 commit 3d4a0f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion enrol/flatfile/lib.php
Expand Up @@ -311,7 +311,7 @@ protected function process_file(progress_trace $trace) {
} }
$roleid = $rolemap[$fields[1]]; $roleid = $rolemap[$fields[1]];


if (!$user = $DB->get_record("user", array("idnumber"=>$fields[2]))) { if (empty($fields[2]) or !$user = $DB->get_record("user", array("idnumber"=>$fields[2]))) {
$trace->output("Unknown user idnumber in field 3 - ignoring line $line", 1); $trace->output("Unknown user idnumber in field 3 - ignoring line $line", 1);
continue; continue;
} }
Expand Down
4 changes: 3 additions & 1 deletion enrol/flatfile/tests/flatfile_test.php
Expand Up @@ -88,6 +88,7 @@ public function test_sync() {
$user4 = $this->getDataGenerator()->create_user(array('idnumber'=>'čtvrtý')); $user4 = $this->getDataGenerator()->create_user(array('idnumber'=>'čtvrtý'));
$user5 = $this->getDataGenerator()->create_user(array('idnumber'=>'u5')); $user5 = $this->getDataGenerator()->create_user(array('idnumber'=>'u5'));
$user6 = $this->getDataGenerator()->create_user(array('idnumber'=>'u6')); $user6 = $this->getDataGenerator()->create_user(array('idnumber'=>'u6'));
$user7 = $this->getDataGenerator()->create_user(array('idnumber'=>''));


$course1 = $this->getDataGenerator()->create_course(array('idnumber'=>'c1')); $course1 = $this->getDataGenerator()->create_course(array('idnumber'=>'c1'));
$course2 = $this->getDataGenerator()->create_course(array('idnumber'=>'c2')); $course2 = $this->getDataGenerator()->create_course(array('idnumber'=>'c2'));
Expand Down Expand Up @@ -124,7 +125,8 @@ public function test_sync() {
add,student,u5,c2,20,10 add,student,u5,c2,20,10
add,student,u6,c1,0,$future add,student,u6,c1,0,$future
add,student,u6,c2,$future,0 add,student,u6,c2,$future,0
add,student,u6,c3,$future,$farfuture"; add,student,u6,c3,$future,$farfuture
add,student,,c2";
file_put_contents($file, $data); file_put_contents($file, $data);


$this->assertEquals(0, $DB->count_records('user_enrolments')); $this->assertEquals(0, $DB->count_records('user_enrolments'));
Expand Down

0 comments on commit 3d4a0f2

Please sign in to comment.