Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save attendance record set even if all are unknown #1148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

radarhere
Copy link
Contributor

Resolves #1042

An attendance record set is only saved when is not empty - in other words, when at least one person is not 'unknown'.

if ($set->processForm($i)) {
$set->save();
}

function processForm($prefix)
{
$this->_attendance_records = Array();
if (isset($_POST['attendances']) && isset($_POST['attendances'][$prefix])) {
foreach ($_POST['attendances'][$prefix] as $personid => $present) {
if (!empty($present) && ($present != 'unknown')) {
$this->_attendance_records[$personid] = (int)($present == 'present');
}
}
}
return count($this->_attendance_records);
}

However, the issue requests that it still save in that situation. This PR changes the behaviour to always save.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't remove the last attendance record for a date
1 participant