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

flatfile enrolment generates wrong email notifications to managers, teachers and students

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.4.3
    • Enrolments
    • None
    • MOODLE_24_STABLE
    • Hide

      So after the flat file enrollment, it was generated the following email notifications:
      1) For useridnumber1 (that is editingteacher + teacher + student): 3 notifications all with the full message of "welcometocoursetext" (so directed to STUDENT), and the following FROM destinations:

      • 1 FROM useridnumber3 - that is manager on the category, which is correct;
      • 2 FROM System administrator - I suspect that those 2 were wrongly generated due to a missing test condition (please see it below);
      • Also there was missing 3 notifications, one for each student enrollment, with the full message of "enrolmentnewuser", informing the teacher of the new flat file enrolments.

      2) For useridnumber2 (that is student): 1 notification which is correctly generated with the STUDENT message, but had been wrongly attached with the FROM, since the FROM was useridnumber3 (that is the manager of category) instead of what would be more correct, i.e., the useridnumber1 (that is the editingteacher and teacher over the course).

      3) For useridnumber3 (that is manager + student): 4 notifications were sent to that user with the following:

      • 1 notification to STUDENT - with the full message of "welcometocoursetext, which is correct, but with the FROM useridnumber3, instead of what would be more correct, i.e., the useridnumber1 (since it is the editingteacher and teacher over the course);
      • 3 notifications, one for each student enrollment, with the full message of "enrolmentnewuser", which is correct.

      After some search for solutions I found the place where it may be required some bug fix:

      I believe that the if ( empty($elog) and ($action== "add")), found on line 254 of \enrol\flatfile\lib.php file, is the responsible for the behavour above referred. And specifically, it may help the following bug fixs:

      1) It appears that there is missing the followng test condition on the if of line 274, in order to add the following:

      Instead of:
      if (!empty($mailstudents))
      Pass to be something like:
      if (!empty($mailstudents) && ($role->archetype == "student"))

      2) It may also need some refatoring of the TODO of line 259, which may be responsible for not detecting correctly the teachers (See (1) For useridnumber1, since it appears that that user, being a teacher, should received the 3 missing notifications with the full message of "enrolmentnewuser", focused to teachers.

      Show
      So after the flat file enrollment, it was generated the following email notifications: 1) For useridnumber1 (that is editingteacher + teacher + student): 3 notifications all with the full message of "welcometocoursetext" (so directed to STUDENT), and the following FROM destinations: 1 FROM useridnumber3 - that is manager on the category, which is correct; 2 FROM System administrator - I suspect that those 2 were wrongly generated due to a missing test condition (please see it below); Also there was missing 3 notifications, one for each student enrollment, with the full message of "enrolmentnewuser", informing the teacher of the new flat file enrolments. 2) For useridnumber2 (that is student): 1 notification which is correctly generated with the STUDENT message, but had been wrongly attached with the FROM, since the FROM was useridnumber3 (that is the manager of category) instead of what would be more correct, i.e., the useridnumber1 (that is the editingteacher and teacher over the course). 3) For useridnumber3 (that is manager + student): 4 notifications were sent to that user with the following: 1 notification to STUDENT - with the full message of "welcometocoursetext, which is correct, but with the FROM useridnumber3, instead of what would be more correct, i.e., the useridnumber1 (since it is the editingteacher and teacher over the course); 3 notifications, one for each student enrollment, with the full message of "enrolmentnewuser", which is correct. After some search for solutions I found the place where it may be required some bug fix: I believe that the if ( empty($elog) and ($action== "add")), found on line 254 of \enrol\flatfile\lib.php file, is the responsible for the behavour above referred. And specifically, it may help the following bug fixs: 1) It appears that there is missing the followng test condition on the if of line 274, in order to add the following: Instead of: if (!empty($mailstudents)) Pass to be something like: if (!empty($mailstudents) && ($role->archetype == "student")) 2) It may also need some refatoring of the TODO of line 259, which may be responsible for not detecting correctly the teachers (See (1) For useridnumber1, since it appears that that user, being a teacher, should received the 3 missing notifications with the full message of "enrolmentnewuser", focused to teachers.
    • Hide

      To test, just created a simple flat file enrollment file with the following lines:
      add, editingteacher, useridnumber1, idnumber of the course
      add, teacher, useridnumber1, idnumber of the course, 1367884800, 1368403200
      add, student, useridnumber1, idnumber of the course, 1367884800, 1368403200
      add, student, useridnumber2, idnumber of the course, 1367884800, 1368403200
      add, student, useridnumber3, idnumber of the course, 1367884800, 1368403200

      All the users was previously created and I have did the same to the course to test the flat file enrollment, with the following particular definitions:

      • The User useridnumber3 has also manager role over the category in which the course "idnumber of the course" was created.
      Show
      To test, just created a simple flat file enrollment file with the following lines: add, editingteacher, useridnumber1, idnumber of the course add, teacher, useridnumber1, idnumber of the course, 1367884800, 1368403200 add, student, useridnumber1, idnumber of the course, 1367884800, 1368403200 add, student, useridnumber2, idnumber of the course, 1367884800, 1368403200 add, student, useridnumber3, idnumber of the course, 1367884800, 1368403200 All the users was previously created and I have did the same to the course to test the flat file enrollment, with the following particular definitions: The User useridnumber3 has also manager role over the category in which the course "idnumber of the course" was created.

      I am using Moodle 2.4.3, previouly migrated from 1.9.8 (passing by 2.2.7 and then to 2.4.3)

      The flatfile processing sends notifications that are not entirely correct, as described on the following fields

            skodak Petr Skoda
            ermoodle Eduardo Rodrigues
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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