Permalink
Browse files

MDL-37161 Backup: Database error caused by grade book settings when i…

…mporting or restoring a course
  • Loading branch information...
1 parent d63a406 commit e5d70123c9556a79cd0f19fa36e02b9be00ea9cd @gaudreaj gaudreaj committed Jan 4, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 backup/moodle2/restore_stepslib.php
@@ -297,8 +297,13 @@ protected function process_grade_setting($data) {
$data->courseid = $this->get_courseid();
- $newitemid = $DB->insert_record('grade_settings', $data);
- //$this->set_mapping('grade_setting', $oldid, $newitemid);
+ if (!$DB->record_exists('grade_settings', array('courseid' => $data->courseid, 'name' => $data->name))) {
+ $newitemid = $DB->insert_record('grade_settings', $data);
+ } else {
+ $newitemid = $data->id;
+ }
+
+ $this->set_mapping('grade_setting', $oldid, $newitemid);
}
/**

0 comments on commit e5d7012

Please sign in to comment.