Merge branch 'MDL-37676' of git://github.com/appalachianstate/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 8 Apr 2013 06:05:21 +0000 (14:05 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 8 Apr 2013 06:05:21 +0000 (14:05 +0800)
backup/moodle2/restore_stepslib.php

index 716d29c..422533f 100644 (file)
@@ -150,6 +150,11 @@ class restore_gradebook_structure_step extends restore_structure_step {
         if ($data->itemtype=='manual') {
             // manual grade items store category id in categoryid
             $data->categoryid = $this->get_mappingid('grade_category', $data->categoryid, NULL);
+            // if mapping failed put in course's grade category
+            if (NULL == $data->categoryid) {
+                $coursecat = grade_category::fetch_course_category($this->get_courseid());
+                $data->categoryid = $coursecat->id;
+            }
         } else if ($data->itemtype=='course') {
             // course grade item stores their category id in iteminstance
             $coursecat = grade_category::fetch_course_category($this->get_courseid());