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

Possible to have two courses with the same ID number

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 2.4.7, 2.5.3
    • 2.4.5, 2.5.1
    • Course
    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • MDL-41417_master
    • Easy
    • Hide
      Before patch is applied
      1. Create a course with an idnumber.
      2. Create another course with a different idnumber.
      3. Edit the second course and change the idnumber to the idnumber for the first course (there is only a check on duplicate idnumbers when creating a course, not updating).
      After patch is applied
      Test 1. Web interface
      1. Go to the settings for one of the courses you created prior to testing and do not edit anything and save, ensure it saves without an idnumber warning (even though the courses share the same idnumber).
      2. Create course with filled shortname and idnumber
      3. Attempt to create another course with the same shortname, make sure the nice descriptive error message appears
      4. Attempt to create another course with the same idnumber, make sure the nice descriptive error message appears
      5. Create another course with different shortname and empty/different idnumber
      6. Attempt to update the second course and set the same shortname as in the first course, make sure the nice descriptive error message appears
      7. Attempt to update the second course and set the same idnumber as in the first course, make sure the nice descriptive error message appears
      8. Edit some other fields and save the changes, make sure there are no errors
      9. Edit second course and try to change shortname to unused one, make sure it is updated ok
      10. Edit second course and try to change idnumber to unused one, make sure it is updated ok
      11. Revoke from teacher capability to change course shortname
      12. Login as teacher and edit any other fields in the course, make sure everything is edited ok and without warnings.
      13. Repeat for user without capability to change course idnumber
      Test 2. Webservices (2.5 and master only)
      1. Create and update course using webservices, make sure you can not create or update course with the same shortname or idnumber as another existing course (basically repeat test 1 but using webservices)
      Show
      Before patch is applied Create a course with an idnumber. Create another course with a different idnumber. Edit the second course and change the idnumber to the idnumber for the first course (there is only a check on duplicate idnumbers when creating a course, not updating). After patch is applied Test 1. Web interface Go to the settings for one of the courses you created prior to testing and do not edit anything and save, ensure it saves without an idnumber warning (even though the courses share the same idnumber). Create course with filled shortname and idnumber Attempt to create another course with the same shortname, make sure the nice descriptive error message appears Attempt to create another course with the same idnumber, make sure the nice descriptive error message appears Create another course with different shortname and empty/different idnumber Attempt to update the second course and set the same shortname as in the first course, make sure the nice descriptive error message appears Attempt to update the second course and set the same idnumber as in the first course, make sure the nice descriptive error message appears Edit some other fields and save the changes, make sure there are no errors Edit second course and try to change shortname to unused one, make sure it is updated ok Edit second course and try to change idnumber to unused one, make sure it is updated ok Revoke from teacher capability to change course shortname Login as teacher and edit any other fields in the course, make sure everything is edited ok and without warnings. Repeat for user without capability to change course idnumber Test 2. Webservices (2.5 and master only) Create and update course using webservices, make sure you can not create or update course with the same shortname or idnumber as another existing course (basically repeat test 1 but using webservices)

      As found while working on MDL-41256 there is no check for duplicate of course ID number when updating the course. It is impossible to create a course with the same ID number as existing but it is possible to create a course without an ID number and then edit it and change to existing ID number.

      Webservices add their own check but instead it should be inside update_course() function (and additional check in course_edit_form::validate() ).

        1. patch_2.txt
          7 kB
          Francis Devine
        2. patch.txt
          3 kB
          Francis Devine

            markn Mark Nelson
            marina Marina Glancy
            Mark Nelson Mark Nelson
            Sam Hemelryk Sam Hemelryk
            David Monllaó David Monllaó
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.