Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-66108

Error "You cannot make a category of one of its own subcategories."

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Log in as admin
      2. Navigate to Courses > Manage courses and categories in Site administration
      3. Create 9 new categories (giving you a total of 10 with the original one):
        1. Parent category should be Top
        2. Category name should be Miscellaneous X (where X is the number 2-10)
      4. Hover over each to confirm the ID numbers run sequentially from 1 - 10 (1 being the original category, followed by the extra ones created above)
      5. Press the checkbox next to the Miscellaneous category (with ID=1)
      6. In the Move selected categories to dropdown menu select Miscellaneous 10 (with ID=10)
      7. Press Move
      8. Confirm that you were able to move the category
      9. Press the checkbox next to Miscellaneous 10 category
      10. In the Move selected categories to dropdown menu select Miscellaneous
      11. Press Move
      12. Confirm you get an error message stating: "You cannot make category 'Miscellaneous 10' a subcategory of one of its own subcategories."
      Show
      Log in as admin Navigate to Courses > Manage courses and categories in Site administration Create 9 new categories (giving you a total of 10 with the original one): Parent category should be Top Category name should be Miscellaneous X (where X is the number 2-10) Hover over each to confirm the ID numbers run sequentially from 1 - 10 (1 being the original category, followed by the extra ones created above) Press the checkbox next to the Miscellaneous category (with ID=1) In the Move selected categories to dropdown menu select Miscellaneous 10 (with ID=10) Press Move Confirm that you were able to move the category Press the checkbox next to Miscellaneous 10 category In the Move selected categories to dropdown menu select Miscellaneous Press Move Confirm you get an error message stating: "You cannot make category 'Miscellaneous 10' a subcategory of one of its own subcategories."
    • Affected Branches:
      MOODLE_35_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Pull 3.8 Branch:
    • Pull Master Branch:

      Description

      Hi! When copying one category to another, the error "You cannot make a category of one of its own subcategories." On closer examination, it turned out that if the category ID in which I copy, for example "320", then categories with ID 3 and 32 cannot be copied into it. This is checked by the condition in the file course / management.php in line 316:

      if (strpos ($movetocat > path, $cattomove> path) === 0) {

      It is not very clear why there is a condition of the form that checks the entry of the path?

        Attachments

          Activity

            People

            Assignee:
            pholden Paul Holden
            Reporter:
            denisvorobiev Denis Vorobiev
            Peer reviewer:
            Neill Magill
            Integrator:
            Jun Pataleta
            Tester:
            Anna Carissa Sadia
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              9/Mar/20

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 40 minutes
                1h 40m