]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12922 restore roll dates - prevent wrong rolls to 0 happening to teachers. Merged...
authorstronk7 <stronk7>
Fri, 2 Jan 2009 17:59:01 +0000 (17:59 +0000)
committerstronk7 <stronk7>
Fri, 2 Jan 2009 17:59:01 +0000 (17:59 +0000)
backup/restore_check.html
backup/restore_form.html

index 350885d5ea4c6f53896bf648e2dfbced6be68a3d..ac35bedda1f6ee5415f961b7628c6018d536002f 100644 (file)
@@ -25,8 +25,8 @@
         $course_header->course_fullname =   $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;
index 8f806f681ee862759805746f8acc51fa6eb1c310..704e37f7be0e7d69da35dbb105c626291ac564c7 100644 (file)
@@ -294,6 +294,11 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
             echo '<input type="hidden" name="startday" value="0" />';
         }
         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>";