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

Cohorts should have idnumbers required when creating and editing.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.4.3
    • Fix Version/s: None
    • Component/s: Cohorts
    • Labels:
      None
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_24_STABLE

      Description

      Cohorts already require unique idnumbers which is good. However, you can create x amount of cohorts each with NO idnumber. This caused a problem when running cron that said:

      Running cron for enrol_cohort...
      !!! Coding error detected, it must be fixed by a programmer: User ID does not exist or is deleted! !!!

      Here is the easy fix:

      open /cohort/edit_form.php
      look for
      public function definition() {

      look for
      $mform->addElement('text', 'idnumber', get_string('idnumber', 'cohort'), 'maxlength="254" size="50"');
      inside that function and add

      $mform->addRule('idnumber', get_string('required'), 'required', null, 'client');

      below it.

      This fixed it for us adding and editing cohorts but I have no idea if there is anywhere else it should be modified OR if the line I have added will break anything else...have removed it for now till you guys decide to use this fix or not...

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                skodak Petr Skoda
                Reporter:
                aosiname Andrew Osiname
                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:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: