From b88244a706c3948fead67c9064785685e266584f Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Wed, 18 Oct 2017 09:38:35 +1300 Subject: [PATCH] Prevent error when updating status when student marking disabled. --- defaultstatus.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/defaultstatus.php b/defaultstatus.php index b1531f2..5a60de2 100644 --- a/defaultstatus.php +++ b/defaultstatus.php @@ -100,7 +100,7 @@ switch ($action) { $acronym = required_param_array('acronym', PARAM_TEXT); $description = required_param_array('description', PARAM_TEXT); $grade = required_param_array('grade', PARAM_RAW); - $studentavailability = required_param_array('studentavailability', PARAM_RAW); + $studentavailability = optional_param_array('studentavailability', '0', PARAM_RAW); $unmarkedstatus = optional_param('setunmarked', null, PARAM_INT); foreach ($grade as &$val) { $val = unformat_float($val); @@ -113,6 +113,9 @@ switch ($action) { if ($unmarkedstatus == $id) { $setunmarked = true; } + if (!isset($studentavailability[$id])) { + $studentavailability[$id] = 0; + } $errors[$id] = attendance_update_status($status, $acronym[$id], $description[$id], $grade[$id], null, null, null, $studentavailability[$id], $setunmarked); }