mirror of
https://github.com/moodle/moodle.git
synced 2025-01-30 03:58:34 +01:00
Merged from MOODLE_14_STABLE - Provide an explicit sortorder for new courses in empty categories, and run fix_course_sortorder() after adding the course to make sure its in the appropriate range for the category. This mege adds fix specific to HEAD: it reverts an earlier bad fix.
This commit is contained in:
parent
97cfb9352c
commit
b935c832ec
@ -86,7 +86,10 @@
|
||||
|
||||
// place at beginning of category
|
||||
fix_course_sortorder();
|
||||
$form->sortorder = get_field_sql("SELECT min(sortorder)-1 FROM {$CFG->prefix}course WHERE category=$form->category") || 1000;
|
||||
$form->sortorder = get_field_sql("SELECT min(sortorder)-1 FROM {$CFG->prefix}course WHERE category=$form->category");
|
||||
if (empty($form->sortorder)) {
|
||||
$form->sortorder = 100;
|
||||
}
|
||||
|
||||
if ($newcourseid = insert_record('course', $form)) { // Set up new course
|
||||
|
||||
@ -120,6 +123,8 @@
|
||||
$USER->teacher[$newcourseid] = true;
|
||||
$USER->teacheredit[$newcourseid] = true;
|
||||
|
||||
fix_course_sortorder();
|
||||
|
||||
redirect("view.php?id=$newcourseid", get_string("changessaved"));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user