MDL-22588 restore scales - fix scales not being assigned to target course. Merged...
authorEloy Lafuente <stronk7@moodle.org>
Fri, 28 May 2010 09:25:21 +0000 (09:25 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Fri, 28 May 2010 09:25:21 +0000 (09:25 +0000)
backup/restorelib.php

index a3121c1..64d75d1 100644 (file)
@@ -3684,6 +3684,10 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
                             } else {
                                 $sca->userid = $USER->id;
                             }
+                            // If course scale, recode the course field
+                            if ($sca->courseid != 0) {
+                                $sca->courseid = $restore->course_id;
+                            }
                             // If scale is standard, if user lacks perms to manage standar scales
                             // 'downgrade' them to course scales
                             if ($sca->courseid == 0 and !has_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM), $sca->userid)) {