Merge branch 'MDL-66108' of https://github.com/paulholden/moodle
authorJun Pataleta <jun@moodle.com>
Tue, 21 Jan 2020 01:51:24 +0000 (09:51 +0800)
committerJun Pataleta <jun@moodle.com>
Tue, 21 Jan 2020 01:51:24 +0000 (09:51 +0800)
course/management.php

index 492a9f1..ad74a3e 100644 (file)
@@ -316,7 +316,8 @@ if ($action !== false && confirm_sesskey()) {
                         $notificationsfail[] = get_string('movecategoryownparent', 'error', $cattomove->get_formatted_name());
                         continue;
                     }
-                    if (strpos($movetocat->path, $cattomove->path) === 0) {
+                    // Don't allow user to move selected category into one of it's own sub-categories.
+                    if (strpos($movetocat->path, $cattomove->path . '/') === 0) {
                         $notificationsfail[] = get_string('movecategoryparentconflict', 'error', $cattomove->get_formatted_name());
                         continue;
                     }