Exercises: Change skip_notification_if_user_in_extra_field to

send_notification_if_user_in_extra_field

See BT#17787
pull/3659/head
Julio Montoya 5 years ago
parent cdf65d2f44
commit 09e19d23dc
  1. 16
      main/inc/lib/exercise.lib.php
  2. 2
      main/install/configuration.dist.php

@ -4627,7 +4627,6 @@ EOT;
}
$question_list_answers = [];
$media_list = [];
$category_list = [];
$loadChoiceFromSession = false;
$fromDatabase = true;
@ -5987,15 +5986,24 @@ EOT;
}
foreach ($notificationList as $attemptData) {
$skipNotification = false;
$skipNotificationList = isset($attemptData['skip_notification_if_user_in_extra_field']) ? $attemptData['skip_notification_if_user_in_extra_field'] : [];
$skipNotificationList = isset($attemptData['send_notification_if_user_in_extra_field']) ? $attemptData['send_notification_if_user_in_extra_field'] : [];
if (!empty($skipNotificationList)) {
foreach ($skipNotificationList as $skipVariable => $skipValues) {
$userExtraFieldValue = $extraFieldValueUser->get_values_by_handler_and_field_variable(
$studentId,
$skipVariable
);
if (!empty($userExtraFieldValue) && isset($userExtraFieldValue['value'])) {
if (in_array($userExtraFieldValue['value'], $skipValues)) {
if (empty($userExtraFieldValue)) {
$skipNotification = true;
break;
} else {
if (isset($userExtraFieldValue['value'])) {
if (!in_array($userExtraFieldValue['value'], $skipValues)) {
$skipNotification = true;
break;
}
} else {
$skipNotification = true;
break;
}

@ -1644,7 +1644,7 @@ $_configuration['auth_password_links'] = [
/*$_configuration['exercise_finished_notification_settings'] = [
'notification_teacher' => [ // Notification label
'for teacher' => [ // for teacher
'skip_notification_if_user_in_extra_field' => [
'send_notification_if_user_in_extra_field' => [
'company_variable' => ['Company A', 'Company B'],
],
'email' => 'teacher1@example.com,teacher2@example.com', // multiple emails allowed

Loading…
Cancel
Save