From 77c21518f20bc58a47f705ff95892ef89351de6b Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Thu, 8 Nov 2018 14:08:43 +0800 Subject: [PATCH] MDL-63919 privacy: Disable notifications for auto created data requests --- .../task/initiate_data_request_task.php | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/admin/tool/dataprivacy/classes/task/initiate_data_request_task.php b/admin/tool/dataprivacy/classes/task/initiate_data_request_task.php index d35f9176ef9..1e02a2f8988 100644 --- a/admin/tool/dataprivacy/classes/task/initiate_data_request_task.php +++ b/admin/tool/dataprivacy/classes/task/initiate_data_request_task.php @@ -88,13 +88,19 @@ class initiate_data_request_task extends adhoc_task { // Get the list of the site Data Protection Officers. $dpos = api::get_site_dpos(); - // Email the data request to the Data Protection Officer(s)/Admin(s). - foreach ($dpos as $dpo) { - $dponame = fullname($dpo); - if (api::notify_dpo($dpo, $datarequest)) { - mtrace('Message sent to DPO: ' . $dponame); - } else { - mtrace('A problem was encountered while sending the message to the DPO: ' . $dponame); + // We should prevent DPO(s)/Admin(s) being flooded with notifications for each request when bulk delete + // data requests are being created. + // NOTE: This should be improved, we should not totally disable the notifications for automatically + // created requests. Possibly, we should create one notification for these such cases. + if ($datarequest->get('creationmethod') != data_request::DATAREQUEST_CREATION_AUTO) { + // Email the data request to the Data Protection Officer(s)/Admin(s). + foreach ($dpos as $dpo) { + $dponame = fullname($dpo); + if (api::notify_dpo($dpo, $datarequest)) { + mtrace('Message sent to DPO: ' . $dponame); + } else { + mtrace('A problem was encountered while sending the message to the DPO: ' . $dponame); + } } } } -- 2.43.0