# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/backup/restore.php
--- moodle/backup/restore.php Base (1.44.2.6)
+++ moodle/backup/restore.php Locally Modified (Based On 1.44.2.6)
@@ -29,11 +29,18 @@
     }
     // To some reasons, course_startdateoffset value was lost during restoring
     // See MDL-17469
+    //course_startdateoffset is not lost and should probably not be set here at all
+    //this fixes the case for using the date submited to the form when creating a new course with a backup
+    //placing the date in the form when replacing
+    $restoring = array(RESTORETO_NEW_COURSE, RESTORETO_EXISTING_ADDING, RESTORETO_CURRENT_ADDING);
+
+    if(!empty($restore->restoreto) && !in_array($restore->restoreto, $restoring)) {
     if (!empty($course->startdate) && !empty($SESSION->course_header->course_startdate)) {
         $SESSION->restore->course_startdateoffset = $course->startdate - $SESSION->course_header->course_startdate;
     } else {
         $SESSION->restore->course_startdateoffset = 0;
     }
+    }
 
     //Check login
     require_login();
