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

External function core_course_External::get_courses_by_field is not returning custom course fields

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.7
    • 3.6.3
    • Course
    • MOODLE_36_STABLE
    • MOODLE_37_STABLE
    • MDL-65212-master
    • Hide
      Setup
      1. Log in as an admin
      2. Go to Site administration / Courses / Course custom fields
      3. Click "Add a new category"
      4. Confirm that a new category "Other fields" is added.
      5. Click "Add a new custom field"
      6. Add 3 short text custom fields with different visidbilities.
      7. Create a course and set values for the custom fields
      8. Enrol a student and a teacher
      9. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      10. Create web service tokens for the teacher and the student.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      Student
      1. Open the console an execute this new curl request, replacing YOUR_WS_TOKEN with the token you just created for the student and the YOUR_MOODLE_URL.

        curl '[YOUR_MOODLE_URL]/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_course_get_courses_by_field&wstoken=[YOUR_WS_TOKEN]' --compressed | python -m json.tool

      2. Confirm that you receive the list of courses, including the course with the customfields you added, with the value, name, type of field and shortname of the field.
      3. Confirm that you can only see the custom field data that is visible to everyone under the "customfields" section.
      4. Confirm that you don't see the custom field data for the teachers and the one not visible for anybody.
      Teacher
      1. Open the console an execute this new curl request, replacing YOUR_WS_TOKEN with the token you just created for the teacher and the YOUR_MOODLE_URL.

        curl '[YOUR_MOODLE_URL]/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_course_get_courses_by_field&wstoken=[YOUR_WS_TOKEN]' --compressed | python -m json.tool

      2. Confirm that you receive the list of courses, including the course with the customfields you added, with the value, name, type of field and shortname of the field.
      3. Confirm that you can only see the custom field data that are visible to everyone and teachers only under the "customfields" section.
      4. Confirm that you don't see the custom field data that is not visible for anybody.
      Show
      Setup Log in as an admin Go to Site administration / Courses / Course custom fields Click " Add a new category " Confirm that a new category "Other fields" is added. Click " Add a new custom field " Add 3 short text custom fields with different visidbilities. Create a course and set values for the custom fields Enrol a student and a teacher Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create web service tokens for the teacher and the student. Click on Site administration ► Plugins ► Web services ► Manage tokens Student Open the console an execute this new curl request, replacing YOUR_WS_TOKEN with the token you just created for the student and the YOUR_MOODLE_URL. curl ' [YOUR_MOODLE_URL] /webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_course_get_courses_by_field&wstoken= [YOUR_WS_TOKEN] ' --compressed | python -m json.tool Confirm that you receive the list of courses, including the course with the customfields you added, with the value, name, type of field and shortname of the field. Confirm that you can only see the custom field data that is visible to everyone under the " customfields " section. Confirm that you don't see the custom field data for the teachers and the one not visible for anybody. Teacher Open the console an execute this new curl request, replacing YOUR_WS_TOKEN with the token you just created for the teacher and the YOUR_MOODLE_URL. curl ' [YOUR_MOODLE_URL] /webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_course_get_courses_by_field&wstoken= [YOUR_WS_TOKEN] ' --compressed | python -m json.tool Confirm that you receive the list of courses, including the course with the customfields you added, with the value, name, type of field and shortname of the field. Confirm that you can only see the custom field data that are visible to everyone and teachers only under the " customfields " section. Confirm that you don't see the custom field data that is not visible for anybody.

      It seems that support for that function was only partially implemented (the returned structure was added but not the code inside the function to fill the data)

        1. MDL-65212 (2).jpg
          38 kB
          Anna Carissa Sadia
        2. MDL-65212.jpg
          51 kB
          Anna Carissa Sadia

            jleyva Juan Leyva
            jleyva Juan Leyva
            Pau Ferrer Pau Ferrer
            Jun Pataleta Jun Pataleta
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 55 minutes
                2h 55m

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