From f276267d936c57d0aa546b4a93cddd7c174d30cd Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 7 Aug 2014 17:47:37 +0100 Subject: [PATCH] MDL-44894 question editing: fix validation with odd permissions For users with edit permissions, but not add permissions, it was impossible to save the editing form. The validation assuemd this value was present, but it was not. Other code checks this field too, so I added it rather than changing the validation and all the other uses. --- question/type/edit_question_form.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/question/type/edit_question_form.php b/question/type/edit_question_form.php index 147e4f8b160..d0e3d278d93 100644 --- a/question/type/edit_question_form.php +++ b/question/type/edit_question_form.php @@ -146,6 +146,9 @@ abstract class question_edit_form extends question_wizard_form { // Editing question with no permission to move from category. $mform->addElement('questioncategory', 'category', get_string('category', 'question'), array('contexts' => array($this->categorycontext))); + $mform->addElement('hidden', 'usecurrentcat', 1); + $mform->setType('usecurrentcat', PARAM_BOOL); + $mform->setConstant('usecurrentcat', 1); } else { // Editing question with permission to move from category or save as new q. $currentgrp = array(); -- 2.43.0