Merge branch 'w31_MDL-27597_m22_catlike' of git://github.com/skodak/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 10 Aug 2011 00:34:51 +0000 (02:34 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 10 Aug 2011 00:34:51 +0000 (02:34 +0200)
lib/datalib.php

index 8aa1f84..478156c 100644 (file)
@@ -847,7 +847,7 @@ function get_categories($parent='none', $sort=NULL, $shallow=true) {
                   FROM {course_categories} cc
                $ccjoin
                   JOIN {course_categories} ccp
-                       ON (cc.path LIKE ".$DB->sql_concat('ccp.path',"'%'").")
+                       ON ((cc.parent = ccp.id) OR (cc.path LIKE ".$DB->sql_concat('ccp.path',"'/%'")."))
                  WHERE ccp.id=?
                 $sort";
         $params = array($parent);