MDL-41594 Bug fix for orphaned invisible categories
authorMarina Glancy <marina@moodle.com>
Thu, 5 Sep 2013 01:30:45 +0000 (11:30 +1000)
committerMarina Glancy <marina@moodle.com>
Tue, 17 Sep 2013 10:58:03 +0000 (20:58 +1000)
thanks to L.Sanocki

lib/coursecatlib.php

index 9cd0f6c..7db820f 100644 (file)
@@ -596,6 +596,9 @@ class coursecat implements renderable, cacheable_object, IteratorAggregate {
             } else {
                 // parent not found. This is data consistency error but next fix_course_sortorder() should fix it
                 $all[0][] = $record->id;
+                if (!$record->visible) {
+                    $all['0i'][] = $record->id;
+                }
             }
             $count++;
         }