Corrected the journal -> Assignment upgrade!!! :-(

This commit is contained in:
moodler
2005-07-12 06:56:22 +00:00
parent fa19bf31ea
commit e92893695d
2 changed files with 16 additions and 2 deletions
+8 -1
View File
@@ -42,7 +42,6 @@ function assignment_online_upgrade($oldversion) {
$assignment->id = insert_record('assignment', $assignment);
/// Now create a new course module record
$oldcm = get_coursemodule_from_instance('journal', $journal->id, $journal->course);
@@ -58,7 +57,13 @@ function assignment_online_upgrade($oldversion) {
/// And locate it above the old one
if (!$section = get_record('course_sections', 'id', $oldcm->section)) {
$section->section = 0; // So it goes somewhere!
}
$newcm->coursemodule = $newcm->id;
$newcm->section = $section->section; // need relative reference
if (! $sectionid = add_mod_to_section($newcm, $oldcm) ) { // Add it before Journal
error("Could not add the new course module to that section");
}
@@ -109,4 +114,6 @@ function assignment_online_upgrade($oldversion) {
}
}
return true;
}
+8 -1
View File
@@ -42,7 +42,6 @@ function assignment_online_upgrade($oldversion) {
$assignment->id = insert_record('assignment', $assignment);
/// Now create a new course module record
$oldcm = get_coursemodule_from_instance('journal', $journal->id, $journal->course);
@@ -58,7 +57,13 @@ function assignment_online_upgrade($oldversion) {
/// And locate it above the old one
if (!$section = get_record('course_sections', 'id', $oldcm->section)) {
$section->section = 0; // So it goes somewhere!
}
$newcm->coursemodule = $newcm->id;
$newcm->section = $section->section; // need relative reference
if (! $sectionid = add_mod_to_section($newcm, $oldcm) ) { // Add it before Journal
error("Could not add the new course module to that section");
}
@@ -109,4 +114,6 @@ function assignment_online_upgrade($oldversion) {
}
}
return true;
}