From a78c180efaca54b165a4223fdf5a1cd06897adcb Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 1 Mar 2013 15:21:09 +0000 Subject: [PATCH] MDL-38279 questions: must have default mark positive. --- lang/en/question.php | 1 + question/type/edit_question_form.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lang/en/question.php b/lang/en/question.php index 0690186781198..cbeb877b33522 100644 --- a/lang/en/question.php +++ b/lang/en/question.php @@ -90,6 +90,7 @@ $string['cwrqpfsnoprob'] = 'No question categories in your site are affected by the \'Random questions selecting questions from sub categories\' issue.'; $string['defaultfor'] = 'Default for {$a}'; $string['defaultinfofor'] = 'The default category for questions shared in context \'{$a}\'.'; +$string['defaultmarkmustbepositive'] = 'The default mark must be positive.'; $string['deletebehaviourareyousure'] = 'Delete behaviour {$a}: are you sure?'; $string['deletebehaviourareyousuremessage'] = 'You are about to completely delete the question behaviour {$a}. This will completely delete everything in the database associated with this question behaviour. Are you SURE you want to continue?'; $string['deletecoursecategorywithquestions'] = 'There are questions in the question bank associated with this course category. If you proceed, they will be deleted. You may wish to move them first, using the question bank interface.'; diff --git a/question/type/edit_question_form.php b/question/type/edit_question_form.php index 478cf3cbcb560..0f74bafc93db0 100644 --- a/question/type/edit_question_form.php +++ b/question/type/edit_question_form.php @@ -654,6 +654,12 @@ public function validation($fromform, $files) { && empty($fromform['usecurrentcat']) && !$this->question->formoptions->canmove) { $errors['currentgrp'] = get_string('nopermissionmove', 'question'); } + + // Default mark. + if ($fromform['defaultmark'] < 0) { + $errors['defaultmark'] = get_string('defaultmarkmustbepositive', 'question'); + } + return $errors; }