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

Unexpected property theme when assign user roles to cohort

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.5
    • Fix Version/s: 3.5
    • Component/s: Cohorts
    • Labels:
    • Testing Instructions:
      Hide

      Setup

      1. Login as admin
      2. Access to "Site administration | Users | Accounts | Cohorts" and create a cohort ("Cohort 1")
      3. Access to "Site administration | Users | Permissions | Define roles" and edit some of the existing roles (for instance, "editingteacher")
      4. Check the "User" option in the "Context types where this role may be assigned" setting.

       

      Testing scenario

      1. Login as admin
      2. Access to "Site administration | Users | Permissions | Assign user roles to cohort".
      3. Select a user ("t1", for instance), select a role ("editingteacher"), select a cohort ("Cohort 1") and click over the "Assign" button.
        • CHECK no error is shown
        • CHECK also the assigned user data is displayed in a table below the "Existing cohort role assignments"
      Show
      Setup Login as admin Access to "Site administration | Users | Accounts | Cohorts" and create a cohort ("Cohort 1") Access to "Site administration | Users | Permissions | Define roles" and edit some of the existing roles (for instance, "editingteacher") Check the "User" option in the "Context types where this role may be assigned" setting.   Testing scenario Login as admin Access to "Site administration | Users | Permissions | Assign user roles to cohort". Select a user ("t1", for instance), select a role ("editingteacher"), select a cohort ("Cohort 1") and click over the "Assign" button. CHECK no error is shown CHECK also the assigned user data is displayed in a table below the "Existing cohort role assignments"
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-62018-master

      Description

      There is an error when you want to access to "Assign user roles to cohort". I attach a screen capture of the error.

      Stack trace:
       
          line 145 of /lib/classes/external/exporter.php: coding_exception thrown
          line 102 of /admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php: call to core\external\exporter->export()
          line 821 of /lib/tablelib.php: call to tool_cohortroles\output\cohort_role_assignments_table->col_cohortname()
          line 1514 of /lib/tablelib.php: call to flexible_table->format_row()
          line 1637 of /lib/tablelib.php: call to table_sql->build_table()
          line 91 of /admin/tool/cohortroles/index.php: call to table_sql->out()
      I think that the error is in the function *col_cohortname* located in  *admin/tool/cohortroles**/classes/output/cohort_role_assignments_table.php.*
      

      This function has an exporter instance of uses cohort_summary_exporter and this has a new param named "theme" and this param is missing in the function.
      This is the code of the function:

      protected function col_cohortname($data) {
              global $OUTPUT;
       
              $record = (object) array(
                  'id' => $data->cohortid,
                  'idnumber' => $data->cohortidnumber,
                  'description' => $data->cohortdescription,
                  'visible' => $data->cohortvisible,
                  'name' => $data->cohortname,
              );
      $context = context_helper::instance_by_id($data->cohortcontextid);
      $exporter = new \core_cohort\external\cohort_summary_exporter($record, array('context' => $context));
      ...
      

      It seems an easy fix to add 'theme' => null to the $record.

        Attachments

        1. Capture.PNG
          88 kB
          Janelle Barcega
        2. Screen Shot 2018-04-17 at 18.01.38.png
          224 kB
          Carlos Escobedo

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/May/18

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 21 minutes
                21m