]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18333: Conditional activities restore bug
authorsam_marshall <sam_marshall>
Fri, 20 Feb 2009 10:48:34 +0000 (10:48 +0000)
committersam_marshall <sam_marshall>
Fri, 20 Feb 2009 10:48:34 +0000 (10:48 +0000)
backup/restorelib.php

index eb6694f9db96a46e33da92a4defa2e0390b79b57..16706e31d0058cf99a3f2cbba98feaaba1c79a68 100644 (file)
@@ -1178,8 +1178,14 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                                         $course_module->completionview=$mod->completionview;
                                         $course_module->completionexpected=$mod->completionexpected;
 
-                                        $course_module->availablefrom=$mod->availablefrom+$restore->course_startdateoffset;
-                                        $course_module->availableuntil=$mod->availableuntil+$restore->course_startdateoffset;
+                                        $course_module->availablefrom=$mod->availablefrom;
+                                        if($mod->availablefrom!=0) {
+                                            $course_module->availablefrom+=$restore->course_startdateoffset;
+                                        }
+                                        $course_module->availableuntil=$mod->availableuntil;
+                                        if($mod->availableuntil!=0) {
+                                            $course_module->availableuntil+=$restore->course_startdateoffset;
+                                        }
                                         $course_module->showavailability=$mod->showavailability;
 
                                         $newidmod = $DB->insert_record("course_modules", $course_module);