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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6.3
    • Fix Version/s: 3.7
    • Component/s: Course
    • Labels:
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-65212-master

      Description

      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)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jleyva Juan Leyva
                Reporter:
                jleyva Juan Leyva
                Peer reviewer:
                Pau Ferrer
                Integrator:
                Jun Pataleta
                Tester:
                Anna Carissa Sadia
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19

                  Time Tracking

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