Skip to content

Commit

Permalink
MDL-27856 Fix incorrect instanceid assignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Sep 13, 2012
1 parent b01c955 commit 9549090
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions enrol/cohort/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down

0 comments on commit 9549090

Please sign in to comment.