]> git.mjollnir.org Git - moodle.git/commitdiff
Merged from MOODLE_14_STABLE - Fixing bug 2334 - where fix_coursesortorder() sometime...
authormartinlanghoff <martinlanghoff>
Tue, 25 Jan 2005 05:27:41 +0000 (05:27 +0000)
committermartinlanghoff <martinlanghoff>
Tue, 25 Jan 2005 05:27:41 +0000 (05:27 +0000)
lib/datalib.php

index 2d02df3277b094d1746c5a2a5f7856689f469f99..abb757a43f0ca21a4b3d6fbfc10805c8e8133c88 100644 (file)
@@ -2384,6 +2384,9 @@ function fix_course_sortorder($categoryid=0, $n=0, $safe=0) {
     }
     set_field('course_categories', 'coursecount', $count, 'id', $categoryid);
 
+    // $n could need updating 
+    $n = get_field_sql("SELECT MAX(sortorder) from {$CFG->prefix}course WHERE category=$categoryid");
+
     if ($categories = get_categories($categoryid)) {
         foreach ($categories as $category) {
             $n = fix_course_sortorder($category->id, $n);