Browse files

MDL-27856 Fix incorrect instanceid assignment.

  • Loading branch information...
1 parent b01c955 commit 9549090df0ed0a651f38af41759cfc9f22ef6fd0 @stronk7 stronk7 committed Sep 13, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 enrol/cohort/lib.php
View
4 enrol/cohort/lib.php
@@ -243,7 +243,7 @@ public function restore_instance(restore_enrolments_structure_step $step, stdCla
if ($data->roleid and $DB->record_exists('cohort', array('id'=>$data->customint1))) {
$instance = $DB->get_record('enrol', array('roleid'=>$data->roleid, 'customint1'=>$data->customint1, 'courseid'=>$course->id, 'enrol'=>$this->get_name()));
if ($instance) {
- $instanceid = $instance;
+ $instanceid = $instance->id;
} else {
$instanceid = $this->add_instance($course, (array)$data);
}
@@ -257,7 +257,7 @@ public function restore_instance(restore_enrolments_structure_step $step, stdCla
$instance = $DB->get_record('enrol', array('roleid'=>$data->roleid, 'customint1'=>$data->customint1, 'courseid'=>$course->id, 'enrol'=>$this->get_name()));
if ($instance) {
- $instanceid = $instance;
+ $instanceid = $instance->id;
} else {
$data->status = ENROL_INSTANCE_DISABLED;
$instanceid = $this->add_instance($course, (array)$data);

0 comments on commit 9549090

Please sign in to comment.