|
@ -79,7 +79,7 @@ if ($data = $mform->get_data()) { |
|
|
if (empty($id)) { |
|
|
if (empty($id)) { |
|
|
$notify->idnumber = 0; |
|
|
$notify->idnumber = 0; |
|
|
} else { |
|
|
} else { |
|
|
$notify->idnumber = $cm->id; |
|
|
$notify->idnumber = $att->id; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$notify->warningpercent = $data->warningpercent; |
|
|
$notify->warningpercent = $data->warningpercent; |
|
@ -105,7 +105,7 @@ if ($data = $mform->get_data()) { |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
$notify = $DB->get_record('attendance_warning', array('id' => $data->notid)); |
|
|
$notify = $DB->get_record('attendance_warning', array('id' => $data->notid)); |
|
|
if (!empty($id) && $data->idnumber != $id) { |
|
|
if (!empty($id) && $data->idnumber != $att->id) { |
|
|
// Someone is trying to update a record for a different attendance. |
|
|
// Someone is trying to update a record for a different attendance. |
|
|
print_error('invalidcoursemodule'); |
|
|
print_error('invalidcoursemodule'); |
|
|
} else { |
|
|
} else { |
|
@ -146,7 +146,7 @@ if ($action == 'delete' && !empty($notid)) { |
|
|
$params = array('id' => $notid); |
|
|
$params = array('id' => $notid); |
|
|
if (!empty($id)) { |
|
|
if (!empty($id)) { |
|
|
// Add id/level to array. |
|
|
// Add id/level to array. |
|
|
$params['idnumber'] = $cm->id; |
|
|
$params['idnumber'] = $id; |
|
|
} |
|
|
} |
|
|
$DB->delete_records('attendance_warning', $params); |
|
|
$DB->delete_records('attendance_warning', $params); |
|
|
echo $OUTPUT->notification(get_string('warningdeleted', 'mod_attendance'), 'success'); |
|
|
echo $OUTPUT->notification(get_string('warningdeleted', 'mod_attendance'), 'success'); |
|
@ -173,7 +173,7 @@ if ($action == 'update' && !empty($notid)) { |
|
|
'warningpercent'); |
|
|
'warningpercent'); |
|
|
} else { |
|
|
} else { |
|
|
$existingnotifications = $DB->get_records('attendance_warning', |
|
|
$existingnotifications = $DB->get_records('attendance_warning', |
|
|
array('idnumber' => $cm->id), |
|
|
array('idnumber' => $att->id), |
|
|
'warningpercent'); |
|
|
'warningpercent'); |
|
|
} |
|
|
} |
|
|
if (!empty($existingnotifications)) { |
|
|
if (!empty($existingnotifications)) { |
|
|