Permalink
Browse files

MDL-30871 enrol: Flat file does not fail when notifications are enabled

  • Loading branch information...
1 parent 9819795 commit 440dec9c272a92635429838e977d2b1c5a34e864 @FMCorz FMCorz committed Oct 30, 2012
Showing with 9 additions and 8 deletions.
  1. +4 −4 enrol/flatfile/lib.php
  2. +5 −4 lib/messagelib.php
@@ -151,7 +151,7 @@ protected function process_file() {
if(! @unlink($filename)) {
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
- $eventdata->component = 'course';
+ $eventdata->component = 'enrol_flatfile';
$eventdata->name = 'flatfile_enrolment';
$eventdata->userfrom = get_admin();
$eventdata->userto = get_admin();
@@ -169,7 +169,7 @@ protected function process_file() {
// Send mail to admin
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
- $eventdata->component = 'course';
+ $eventdata->component = 'enrol_flatfile';
$eventdata->name = 'flatfile_enrolment';
$eventdata->userfrom = get_admin();
$eventdata->userto = get_admin();
@@ -280,7 +280,7 @@ private function process_records($action, $roleid, $user, $course, $timestart, $
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
- $eventdata->component = 'course';
+ $eventdata->component = 'enrol_flatfile';
$eventdata->name = 'flatfile_enrolment';
$eventdata->userfrom = $teacher;
$eventdata->userto = $user;
@@ -303,7 +303,7 @@ private function process_records($action, $roleid, $user, $course, $timestart, $
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
- $eventdata->component = 'course';
+ $eventdata->component = 'enrol_flatfile';
$eventdata->name = 'flatfile_enrolment';
$eventdata->userfrom = $user;
$eventdata->userto = $teacher;
View
@@ -129,10 +129,11 @@ function message_send($eventdata) {
if (isset($defaultpreferences->{$defaultpreference})) {
$permitted = $defaultpreferences->{$defaultpreference};
} else {
- //MDL-25114 They supplied an $eventdata->component $eventdata->name combination which doesn't
- //exist in the message_provider table (thus there is no default settings for them)
- $preferrormsg = get_string('couldnotfindpreference', 'message', $defaultpreference);
- throw new coding_exception($preferrormsg,'blah');
+ // MDL-25114 They supplied an $eventdata->component $eventdata->name combination which doesn't
+ // exist in the message_provider table (thus there is no default settings for them).
+ $preferrormsg = "Could not load preference $defaultpreference. Make sure the component and name you supplied
+ to message_send() are valid.";
+ throw new coding_exception($preferrormsg);
}
// Find out if user has configured this output

0 comments on commit 440dec9

Please sign in to comment.