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

Custom field filtering can fail where there is another field with same shortname

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-79027-403
    • Hide
      1. Log in as admin
      2. Navigate to Courses > Course custom fields in site administration
      3. Create a new custom field
        • Name: First
        • Shortname: first
      4. (4.3 and main only) Navigate to Courses > Group custom fields in site administration
      5. (4.3 and main only) Create a new custom field
        • Name: First
        • Shortname: first
      6. Navigate to Plugins > Blocks > Course oveview in site administration
        • Custom field: Yes
        • Field to use: First
      7. Create a new course
        • First: Some text
      8. Navigate to dashboard
      9. Add Course overview block
      10. Confirm there is no debugging on the page
      11. Change the All filter to Some text
      12. Confirm your new course is shown
      Show
      Log in as admin Navigate to Courses > Course custom fields in site administration Create a new custom field Name: First Shortname: first (4.3 and main only) Navigate to Courses > Group custom fields in site administration ( 4.3 and main only ) Create a new custom field Name: First Shortname: first Navigate to Plugins > Blocks > Course oveview in site administration Custom field: Yes Field to use: First Create a new course First: Some text Navigate to dashboard Add Course overview block Confirm there is no debugging on the page Change the All filter to Some text Confirm your new course is shown

      In block_myoverview, we can choose a custom field to enable filtering by, but this does not work if there is an existing custom field (not a course field) with the same shortname.

      To reproduce:

      • Go to /question/bank/customfields/customfield.php and create a field with shortname "test"
      • Go to /course/customfield.php and create a field with shortname "test"
      • Go to /admin/settings.php?section=blocksettingmyoverview, tick the "Custom field" box and set the "Field to use" to the course custom field just created
      • Create a course and set the custom field just created to "TEST"
      • Add the "Course overview" to your dashboard
      • You will see an error message "Error: mdb->get_record() found more than one record!" (if debug display is on) and the course field value added does not appear in the filter list. Expected behaviour is that "TEST" appears in the filter list.
      • Delete the question custom field created in the first step and refresh the dashboard page. "TEST" now appears in the list as expected.

        1. (1) 10 Passed -- (Main)MDL-79027.png
          127 kB
          Kim Jared Lucas
        2. (1) 12 Passed -- (Main)MDL-79027.png
          39 kB
          Kim Jared Lucas

            pholden Paul Holden
            maherne Michael Aherne
            Michael Aherne Michael Aherne
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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