projects
/
moodle-mod_attendance.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a98bb53
)
Fixes #302 make sure user lang is used when sending mail.
author
Dan Marsden
<dan@danmarsden.com>
Tue, 1 May 2018 02:43:05 +0000
(14:43 +1200)
committer
Dan Marsden
<dan@danmarsden.com>
Tue, 1 May 2018 02:43:05 +0000
(14:43 +1200)
classes/task/notify.php
patch
|
blob
|
history
diff --git
a/classes/task/notify.php
b/classes/task/notify.php
index
11b7137
..
70aaa09
100644
(file)
--- a/
classes/task/notify.php
+++ b/
classes/task/notify.php
@@
-91,11
+91,13
@@
class notify extends \core\task\scheduled_task {
$record = attendance_template_variables($record);
$user = $DB->get_record('user', array('id' => $record->userid));
$from = \core_user::get_noreply_user();
$record = attendance_template_variables($record);
$user = $DB->get_record('user', array('id' => $record->userid));
$from = \core_user::get_noreply_user();
+ $oldforcelang = force_current_language($user->lang);
$emailcontent = format_text($record->emailcontent, $record->emailcontentformat);
$emailcontent = format_text($record->emailcontent, $record->emailcontentformat);
+ $emailsubject = format_text($record->emailsubject);
+ email_to_user($user, $from, $emailsubject, $emailcontent, $emailcontent);
- email_to_user($user, $from, $record->emailsubject, $emailcontent, $emailcontent);
-
+ force_current_language($oldforcelang);
$sentnotifications[$record->userid][] = $record->aid;
$numsentusers++;
}
$sentnotifications[$record->userid][] = $record->aid;
$numsentusers++;
}
@@
-137,6
+139,7
@@
class notify extends \core\task\scheduled_task {
foreach ($thirdpartynotifications as $sendid => $notifications) {
$user = $DB->get_record('user', array('id' => $sendid));
$from = \core_user::get_noreply_user();
foreach ($thirdpartynotifications as $sendid => $notifications) {
$user = $DB->get_record('user', array('id' => $sendid));
$from = \core_user::get_noreply_user();
+ $oldforcelang = force_current_language($user->lang);
$emailcontent = implode("\n", $notifications);
$emailcontent .= "\n\n".get_string('thirdpartyemailtextfooter', 'attendance');
$emailcontent = implode("\n", $notifications);
$emailcontent .= "\n\n".get_string('thirdpartyemailtextfooter', 'attendance');
@@
-144,6
+147,7
@@
class notify extends \core\task\scheduled_task {
$emailsubject = get_string('thirdpartyemailsubject', 'attendance');
email_to_user($user, $from, $emailsubject, $emailcontent, $emailcontent);
$emailsubject = get_string('thirdpartyemailsubject', 'attendance');
email_to_user($user, $from, $emailsubject, $emailcontent, $emailcontent);
+ force_current_language($oldforcelang);
$numsentthird++;
}
if (!empty($numsentthird)) {
$numsentthird++;
}
if (!empty($numsentthird)) {