MDL-37390 course: Set startdate and enddate properly for approved course

Once a course is approved the startdate and enddate were not set properly
This patch sets current date as startdate and enddate is startdate +
default duration of the course
This commit is contained in:
Farhan Karmali 2017-12-29 20:13:48 +05:30 committed by Sara Arjona
parent f5b956679e
commit 6363c9ade2

View File

@ -3017,6 +3017,10 @@ class course_request {
$data->lang = $courseconfig->lang;
$data->enablecompletion = $courseconfig->enablecompletion;
$data->numsections = $courseconfig->numsections;
$data->startdate = usergetmidnight(time());
if ($courseconfig->courseenddateenabled) {
$data->enddate = usergetmidnight(time()) + $courseconfig->courseduration;
}
$course = create_course($data);
$context = context_course::instance($course->id, MUST_EXIST);