]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14797 - Error when moving a course to an empty category on Postgres
authortjhunt <tjhunt>
Mon, 12 May 2008 10:44:44 +0000 (10:44 +0000)
committertjhunt <tjhunt>
Mon, 12 May 2008 10:44:44 +0000 (10:44 +0000)
course/lib.php

index 3e79a8252229d2a2be859bbe51b9f6c6a05a6666..07a2af96041919f7187af65e8d6c209e6b622e40 100644 (file)
@@ -2725,7 +2725,7 @@ function move_courses ($courseids, $categoryid) {
                     // figure out a sortorder that we can use in the destination category
                     $sortorder = get_field_sql('SELECT MIN(sortorder)-1 AS min
                                                     FROM ' . $CFG->prefix . 'course WHERE category=' . $categoryid);
-                    if ($sortorder === false) {
+                    if (is_null($sortorder) || $sortorder === false) {
                         // the category is empty
                         // rather than let the db default to 0
                         // set it to > 100 and avoid extra work in fix_coursesortorder()