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

External function: update_categories does not update the path field when moving category

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Course, Web Services
    • Labels:
    • Testing Instructions:
      Hide

      Run the REST demo client
      Call core_course_update_categories(). You must move a category from a parent to another parent. Check that the moved category has a correct path. For example if it was moved from category1->id = 4 to category2->id = 5, then the path should have been updated from /4/X to /5/X

      You can check the path field in the DB table: course_categories

      Alternative test:
      you can take my phpunit test for this function in https://github.com/mouneyrac/moodle/commit/bae128d5e1124a191d00648e1aca57f6b407ca1c (MDL-33529) - it's done and it will be much faster test to call this unit test (if you do so, comment the other PHPunit test because lots of them are related to fix waiting to be integrated. If you don't comment other tests they will throw errors to you.)

      Show
      Run the REST demo client Call core_course_update_categories(). You must move a category from a parent to another parent. Check that the moved category has a correct path. For example if it was moved from category1->id = 4 to category2->id = 5, then the path should have been updated from /4/X to /5/X You can check the path field in the DB table: course_categories Alternative test: you can take my phpunit test for this function in https://github.com/mouneyrac/moodle/commit/bae128d5e1124a191d00648e1aca57f6b407ca1c ( MDL-33529 ) - it's done and it will be much faster test to call this unit test (if you do so, comment the other PHPunit test because lots of them are related to fix waiting to be integrated. If you don't comment other tests they will throw errors to you.)
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:

      Description

      fix_course_sortorder() called is overwritten by a later $DB->update call.

      To fix:

      // Get updated path by move_category().
      $category->path = $DB->get_field('course_categories', 'path',
                              array('id' => $category->id));

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    25/Jun/12