Skip to content

Commit

Permalink
Updated email subject to contain Account Name
Browse files Browse the repository at this point in the history
  • Loading branch information
devang1281 committed Sep 14, 2020
1 parent d173bca commit 7991e54
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
12 changes: 8 additions & 4 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public static function delete_data_for_users(approved_userlist $userlist) {
$txt .= ", {$userid}";
}
}
$txt .= ")\nUser Token: {$token}\nSession ID is like ( {$quiz->id}-* )";
$txt .= ")\nSession ID is like ( {$quiz->id}-* )";

self::send_mail($to, $reply, $from, $txt);
$DB->delete_records_select('local_proview', $sql, $params);
Expand Down Expand Up @@ -262,7 +262,7 @@ public static function delete_data_for_all_users_in_context(\context $context) {
$from = self::get_from_user();

$txt = "As per GDPR Compliance, Please Delete the Proview data for all the sessions with\n";
$txt = "User Token: {$token}\nSession ID is like ( {$quizid}-* )";
$txt .= "Session ID is like ( {$quizid}-* )";

self::send_mail($to, $reply, $from, $txt);
$DB->delete_records('local_proview', ['quiz_id' => $quizid]);
Expand Down Expand Up @@ -300,7 +300,7 @@ public static function delete_data_for_user(approved_contextlist $contextlist) {
}

$txt = "As per GDPR Compliance, Please Delete the Proview data for the following details\n";
$txt = "Profile ID: {$user->id}\nUser Token: {$token}\nSession ID is like ( ";
$txt .= "Profile ID: {$user->id}\nSession ID is like ( ";
foreach ($quizids as $index => $quizid) {
if ($index === 0) {
$txt .= "{$quizid}-*";
Expand Down Expand Up @@ -361,7 +361,11 @@ private static function get_from_user() : array {
private static function send_mail(array $to, array $reply, array $from, string $txt) {
$sitename = get_site();
$token = get_config('local_proview', 'token');
$subject = "GDPR Request from Moodle | {$sitename->fullname}";
$account = get_config('local_proview', 'proview_acc_name');
if ($account == '') {
$account = $sitename->fullname;
}
$subject = "GDPR Request from Moodle | {$account}";

$mail = get_mailer();
$mail->isHTML(false);
Expand Down
2 changes: 2 additions & 0 deletions lang/en/local_proview.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
$string['token_desc'] = 'For example: U9021015';
$string['enabled'] = 'Enabled';
$string['enabled_desc'] = 'Enable Proview for Moodle';
$string['proview_acc_name'] = 'Proview Account Name';
$string['proview_acc_name_desc'] = 'Account Name provided by Talview, If not provided use your organisation name.';
$string['root_dir'] = 'Root Dir';
$string['root_dir_desc'] = 'Root Dir';

Expand Down
7 changes: 7 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
$setting = new admin_setting_configtext($name, $title, $description, $default);
$settings->add($setting);

$name = 'local_proview/proview_acc_name';
$title = get_string('proview_acc_name', 'local_proview');
$description = get_string('proview_acc_name_desc', 'local_proview');
$default = '';
$setting = new admin_setting_configtext($name, $title, $description, $default);
$settings->add($setting);

$name = 'local_proview/root_dir';
$title = get_string('root_dir', 'local_proview');
$description = get_string('root_dir_desc', 'local_proview');
Expand Down

0 comments on commit 7991e54

Please sign in to comment.