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

[v4.1.1] [Moodle 4.4.6] [PHP 8.1] course/defaultcompletion.php - Form validation error when checking and saving with custom completion rule "submit" #626

Open
danowar2k opened this issue Mar 3, 2025 · 0 comments

Comments

@danowar2k
Copy link

Moodle 4.4 requires custom completion rules to have a suffix "_$modname".

When Moodle checks if automatic completion is enabled here: https://github.com/moodle/moodle/blob/b132ff1ed83dbe243909b8b121304ab20c0f069c/completion/classes/form/form_trait.php#L403

mod_questionnaire checks the given $data object only for the rule name without the suffix:

public function completion_rule_enabled($data) {
return !empty($data['completionsubmit']);
}

while earlier it did create the form elements with the suffix:

$mform =& $this->_form;
$mform->addElement('checkbox', 'completionsubmit' . $suffix, '',
get_string('completionsubmit', 'questionnaire'));
return ['completionsubmit' . $suffix];

This leads to the bug that the custom completion rule can't be activated and therefore not be used (at least as a default)

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

No branches or pull requests

1 participant