MDL-62011 course: Approval of a course request fails

This commit is contained in:
Andreas Grabs 2018-04-17 11:49:34 +02:00 committed by Andreas Grabs
parent 6fa694bef0
commit 9f9d7bbe87

View File

@ -2988,6 +2988,8 @@ class course_request {
public function approve() {
global $CFG, $DB, $USER;
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
$user = $DB->get_record('user', array('id' => $this->properties->requester, 'deleted'=>0), '*', MUST_EXIST);
$courseconfig = get_config('moodlecourse');
@ -3022,6 +3024,8 @@ class course_request {
$data->enddate = usergetmidnight(time()) + $courseconfig->courseduration;
}
list($data->fullname, $data->shortname) = restore_dbops::calculate_course_names(0, $data->fullname, $data->shortname);
$course = create_course($data);
$context = context_course::instance($course->id, MUST_EXIST);