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

Textarea custom field can't be updated by core_course_update_courses webservice

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.9.2
    • Fix Version/s: None
    • Component/s: Course, Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. Enable web services
      2. Create external service
      3. Add core_course_update_courses function to the service
      4. Create a user and token for a service
      5. Create custom course field at course/customfield.php which is Text area type
      6. Create a course
      7. Try calling webservice that updates your custom field

        http://localhost/webservice/rest/server.php?moodlewsrestformat=json&wstoken=1ecf0147be593513316042893106b8d1&wsfunction=core_course_update_courses&courses[0][id]=2&courses[0][shortname]=updated&courses[0][customfields][0][shortname]=textareaaaa&courses[0][customfields][0][value]=ddd
        

      8. Ensure custom course field is updated - you can see it when editing course settings
      Show
      Enable web services Create external service Add core_course_update_courses function to the service Create a user and token for a service Create custom course field at course/customfield.php which is Text area type Create a course Try calling webservice that updates your custom field http: //localhost/webservice/rest/server.php?moodlewsrestformat=json&wstoken=1ecf0147be593513316042893106b8d1&wsfunction=core_course_update_courses&courses[0][id]=2&courses[0][shortname]=updated&courses[0][customfields][0][shortname]=textareaaaa&courses[0][customfields][0][value]=ddd Ensure custom course field is updated - you can see it when editing course settings
    • Affected Branches:
      MOODLE_39_STABLE

      Description

      Custom fields of type textarea are not updated when calling course update core webservice without a warning. They are just ignored.

      Looking into the code, textarea data_controller looks for {customfieldshortname}_editor param to be an array with text and format keys, but webservice allows only external value of PARAM_ALPHANUMEXT type.

      I'm not sure if the bug belongs to core webservice or to customfield handler, but as textarea is kind of special type (ie. wants _editor appended to shortname) I think it should care of being able to update through webservice.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            carreraj Juan Carrera
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona), Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: