From 62e02e583f2a54e3ea14207379da6ea4aa982b66 Mon Sep 17 00:00:00 2001 From: sam marshall Date: Thu, 1 May 2014 18:08:06 +0100 Subject: [PATCH] MDL-45376 Completion: Form locking is still not working right On submit of the form, it called 'freeze' on the completion-related fields (even though they shouldn't have been frozen because you already clicked the unlock button). --- course/moodleform_mod.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/course/moodleform_mod.php b/course/moodleform_mod.php index 9b548339c31..1ee017ae59d 100644 --- a/course/moodleform_mod.php +++ b/course/moodleform_mod.php @@ -224,8 +224,10 @@ abstract class moodleform_mod extends moodleform { // is changed, maybe someone has completed it now) $mform->getElement('completionunlocked')->setValue(1); } else { - // Has the element been unlocked? - if ($mform->exportValue('unlockcompletion')) { + // Has the element been unlocked, either by the button being pressed + // in this request, or the field already being set from a previous one? + if ($mform->exportValue('unlockcompletion') || + $mform->exportValue('completionunlocked')) { // Yes, add in warning text and set the hidden variable $mform->insertElementBefore( $mform->createElement('static', 'completedunlocked',