Permalink
Browse files

MDL-41590 Enrolments: If course is deleted, then use courseid for ref…

…erence
  • Loading branch information...
1 parent 5e99c1f commit 1e557db89d86b311c06f0419444816cda03691f4 @rajeshtaneja rajeshtaneja committed with Sam Hemelryk Sep 4, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 enrol/meta/lib.php
View
@@ -47,7 +47,12 @@ public function get_instance_name($instance) {
} else if (empty($instance->name)) {
$enrol = $this->get_name();
$course = $DB->get_record('course', array('id'=>$instance->customint1));
- $coursename = format_string(get_course_display_name_for_list($course));
+ if ($course) {
+ $coursename = format_string(get_course_display_name_for_list($course));
+ } else {
+ // Use course id, if course is deleted.
+ $coursename = $instance->customint1;
+ }
return get_string('pluginname', 'enrol_' . $enrol) . ' (' . $coursename . ')';
} else {
return format_string($instance->name);

0 comments on commit 1e557db

Please sign in to comment.