MDL-12922 restore roll dates - prevent wrong rolls to 0 happening to teachers. Backported from HEAD

This commit is contained in:
stronk7
2009-01-02 18:00:43 +00:00
parent d9933413df
commit f49b1e379b
2 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -22,8 +22,8 @@
$course_header->course_fullname = stripslashes_safe($form1->fullname); //"update_FullName";
/// Roll dates only if the backup course has a start date
/// (some formats like main page, social..., haven't it and rolling dates
/// from 0 produces crazy dates. MDL-10125
if ($course_header->course_startdate) {
/// from 0 produces crazy dates. MDL-10125 and we have passed some custom startyear/month/day. MDL-12922
if ($course_header->course_startdate && !empty($form1->startyear)) {
$form1->startdate = make_timestamp($form1->startyear, $form1->startmonth, $form1->startday);
$currentcoursestartdate = $course_header->course_startdate;
$coursestartdatedateoffset = $form1->startdate - $currentcoursestartdate;
+6 -1
View File
@@ -254,6 +254,11 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
}
helpbutton("coursestartdate", get_string("startdate"));
echo "</td></tr>";
} else {
/// If user cannot create course, prevent any change in startyear/month/day (so restore wont calculate any roll. MDL-12922
echo '<input type="hidden" name="startyear" value="0" />';
echo '<input type="hidden" name="startmonth" value="0" />';
echo '<input type="hidden" name="startday" value="0" />';
}
//Line
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
@@ -635,4 +640,4 @@ function restore_is_samerole($rolea, $roleb) {
}
return true;
}
?>
?>