edit.php
1. In the instance setting, users who should receive the application notification would not save.
a. Solution: Save the users to table enrol->customtext3.
edit-form.php
1. In the instance setting, users who selected to receive the application notification would not set as selected (may confusing people).
a. Solution: Query to table ‘enrol’ and the selected users as selected.
lib.php
1. After make change to instance settings, users with ‘enrol/apply:manageapplications’ capability would not receive enrollment application notification.
a. Sender and receiver share the same variable ($user) in send_application_notification()
b. The sender in send_application_notification() is set to $contact, which assigned to user with ‘enrol/apply:manageapplications’.
2. Variable $value in get_notifycoursebased_users() is assigned to $instance->customtext2, while customtext2 is the Custom Label. Therefore, this function would not return the user should receive application notification.
a. Solution: change customtext2 to custometext3.
3. Admin will receive two notification from one application.
a. get_users_from_config() in get_notifyglobal_users() without a ‘false’ in third parameter.
b. Solution: add ‘false’ to third parameter.
Environment: Moodle v3.6.2+ (build )
* Replace global 'sendmailtoteacher' setting (checkbox) by 'notifycoursebased' (checkbox):
default for new instances
* Replace global 'sendmailtomanager' setting (checkbox) by 'notifyglobal' (multi-select):
user based selection (users with 'manageapplications' capability in system context)
* Replace instance notification setting (checkbox) by user based selection (multi-select):
enrolled users with 'manageapplications' capability in course context
* Upgrade process:
* if 'sendmailtoteacher' was true, set 'notifycoursebased' true
* if 'sendmailtomanager' was true, set 'notifyglobal' to
"Everyone who can 'Manage apply enrolment'", "Nobody" otherwise
* if instance based notification setting was set to true,
set new user based setting to "Everyone who can 'Manage apply enrolment'", "Nobody" otherwise
Change name of enrol/apply:manage to enrol/apply:manageapplications to avoid confusion with reserved enrol/xxx:manage for manual enrolment status changes (see also allow_manage() method).
Remove unnecessary enrol/apply:enrol capability (plugin does not allow manual enrolment of other users)
Add description comments.