From: tjhunt Date: Mon, 20 Apr 2009 05:59:11 +0000 (+0000) Subject: category paths: MDL-18897 call fix_course_sortorder eveywhere we insert a category... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=7a9d505bb928d8249b89ce06bea22c63a57191aa;p=moodle.git category paths: MDL-18897 call fix_course_sortorder eveywhere we insert a category to set category.path and .depth --- diff --git a/course/editcategory.php b/course/editcategory.php index 1b03cf1c56..0064065894 100644 --- a/course/editcategory.php +++ b/course/editcategory.php @@ -75,6 +75,7 @@ if ($mform->is_cancelled()) { } $newcategory->context = get_context_instance(CONTEXT_COURSECAT, $newcategory->id); mark_context_dirty($newcategory->context->path); + fix_course_sortorder(); // Required to build course_categories.depth and .path. } redirect('category.php?id='.$newcategory->id.'&categoryedit=on'); } diff --git a/course/index.php b/course/index.php index 6ea66f7baf..0613b082c6 100644 --- a/course/index.php +++ b/course/index.php @@ -153,6 +153,7 @@ } $tempcat->context = get_context_instance(CONTEXT_COURSECAT, $tempcat->id); mark_context_dirty('/'.SYSCONTEXTID); + fix_course_sortorder(); // Required to build course_categories.depth and .path. } /// Move a category to a new parent if required diff --git a/lib/datalib.php b/lib/datalib.php index 3a04e29172..dcc863a7a9 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -1221,6 +1221,7 @@ function get_course_category($catid=0) { // make sure category context exists get_context_instance(CONTEXT_COURSECAT, $catid); mark_context_dirty('/'.SYSCONTEXTID); + fix_course_sortorder(); // Required to build course_categories.depth and .path. $category = $DB->get_record('course_categories', array('id'=>$catid)); } }