From 3a94a08f2c6c1ca1a2e086aba28ef9d34efd7ebe Mon Sep 17 00:00:00 2001 From: maksudr <12033826+maksudr@users.noreply.github.com> Date: Thu, 25 Apr 2019 03:31:57 +0100 Subject: [PATCH] Fixes #379 - Error logic for QR Code import error (#382) --- classes/import/sessions.php | 6 ++++++ lang/en/attendance.php | 1 + 2 files changed, 7 insertions(+) diff --git a/classes/import/sessions.php b/classes/import/sessions.php index 6a148fd..9c8fc29 100644 --- a/classes/import/sessions.php +++ b/classes/import/sessions.php @@ -350,6 +350,12 @@ class sessions { $session->includeqrcode = $pluginconfig->includeqrcode_default; } else { $session->includeqrcode = $this->get_column_data($row, $mapping['includeqrcode']); + + if ($session->includeqrcode == 1 && $session->studentscanmark != 1) { + \mod_attendance_notifyqueue::notify_problem(get_string('error:qrcode', 'attendance')); + continue; + } + } $session->statusset = 0; diff --git a/lang/en/attendance.php b/lang/en/attendance.php index 867dfc7..65c2b21 100644 --- a/lang/en/attendance.php +++ b/lang/en/attendance.php @@ -200,6 +200,7 @@ $string['error:sessioncourseinvalid'] = 'A session course is invalid! Skipping.' $string['error:sessiondateinvalid'] = 'A session date is invalid! Skipping.'; $string['error:sessionendinvalid'] = 'A session end time is invalid! Skipping.'; $string['error:sessionstartinvalid'] = 'A session start time is invalid! Skipping.'; +$string['error:qrcode'] = 'Allow students to record own attendance must be enabled to use QR code! Skipping.'; $string['errorgroupsnotselected'] = 'Select one or more groups'; $string['errorinaddingsession'] = 'Error in adding session'; $string['erroringeneratingsessions'] = 'Error in generating sessions ';