Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…erence
  • Loading branch information...
commit 1e557db89d86b311c06f0419444816cda03691f4 1 parent 5e99c1f
@rajeshtaneja rajeshtaneja authored samhemelryk committed
Showing with 6 additions and 1 deletion.
  1. +6 −1 enrol/meta/lib.php
View
7 enrol/meta/lib.php
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.