Merge branch 'MDL-65233-404-no-midnight' of https://github.com/sim642/moodle into MOODLE_404_STABLE
This commit is contained in:
@@ -186,7 +186,7 @@ class course_reset_form extends moodleform {
|
||||
$coursedata['enddate'] = $data['reset_end_date'];
|
||||
} else if ($data['reset_start_date'] > 0 && $course->enddate != 0) {
|
||||
// Otherwise, if the current course enddate is set, reset_course_userdata will add the start date time shift to it.
|
||||
$timeshift = $data['reset_start_date'] - usergetmidnight($course->startdate);
|
||||
$timeshift = $data['reset_start_date'] - $course->startdate;
|
||||
$coursedata['enddate'] = $course->enddate + $timeshift;
|
||||
} else {
|
||||
$coursedata['enddate'] = $course->enddate;
|
||||
|
||||
@@ -3696,7 +3696,16 @@ final class courselib_test extends advanced_testcase {
|
||||
$time + YEARSECS,
|
||||
$time + WEEKSECS,
|
||||
$time + YEARSECS
|
||||
]
|
||||
],
|
||||
// Time shift is between exact times, not midnight(s) (MDL-65233).
|
||||
[
|
||||
$time + HOURSECS,
|
||||
$time + DAYSECS,
|
||||
$time + WEEKSECS + HOURSECS,
|
||||
false,
|
||||
$time + WEEKSECS + HOURSECS,
|
||||
$time + WEEKSECS + DAYSECS,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -5060,8 +5060,7 @@ function reset_course_userdata($data) {
|
||||
|
||||
// Calculate the time shift of dates.
|
||||
if (!empty($data->reset_start_date)) {
|
||||
// Time part of course startdate should be zero.
|
||||
$data->timeshift = $data->reset_start_date - usergetmidnight($data->reset_start_date_old);
|
||||
$data->timeshift = $data->reset_start_date - $data->reset_start_date_old;
|
||||
} else {
|
||||
$data->timeshift = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user