From 16590517fad1f3e10416929bc87120ec1c8b9671 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Thu, 27 Nov 2008 05:12:11 +0000 Subject: [PATCH] fix notices: MDL-15974 Some systems that were upgraded have nullable columns, leading to notices A new install has NOT NULL DEFAULT 0. --- mod/quiz/accessrules.php | 10 +++++----- question/type/multichoice/questiontype.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mod/quiz/accessrules.php b/mod/quiz/accessrules.php index 92d22fc10a..7ef4cec21a 100644 --- a/mod/quiz/accessrules.php +++ b/mod/quiz/accessrules.php @@ -29,20 +29,20 @@ class quiz_access_manager { $this->_rules[] = new num_attempts_access_rule($this->_quizobj, $this->_timenow); } $this->_rules[] = new open_close_date_access_rule($this->_quizobj, $this->_timenow); - if ($quiz->timelimit && !$canignoretimelimits) { + if (!empty($quiz->timelimit) && !$canignoretimelimits) { $this->_rules[] = new time_limit_access_rule($this->_quizobj, $this->_timenow); } - if ($quiz->delay1 || $quiz->delay2) { + if (!empty($quiz->delay1) || !empty($quiz->delay2)) { $this->_rules[] = new inter_attempt_delay_access_rule($this->_quizobj, $this->_timenow); } - if ($quiz->subnet) { + if (!empty($quiz->subnet)) { $this->_rules[] = new ipaddress_access_rule($this->_quizobj, $this->_timenow); } - if ($quiz->password) { + if (!empty($quiz->password)) { $this->_passwordrule = new password_access_rule($this->_quizobj, $this->_timenow); $this->_rules[] = $this->_passwordrule; } - if ($quiz->popup) { + if (!empty($quiz->popup)) { $this->_securewindowrule = new securewindow_access_rule($this->_quizobj, $this->_timenow); $this->_rules[] = $this->_securewindowrule; } diff --git a/question/type/multichoice/questiontype.php b/question/type/multichoice/questiontype.php index f8d3c7af3a..6e64dd86d9 100644 --- a/question/type/multichoice/questiontype.php +++ b/question/type/multichoice/questiontype.php @@ -167,7 +167,7 @@ class question_multichoice_qtype extends default_questiontype { $answerids = array_values(array_map(create_function('$val', 'return $val->id;'), $question->options->answers)); // Shuffle the answers if required - if ($cmoptions->shuffleanswers and $question->options->shuffleanswers) { + if (!empty($cmoptions->shuffleanswers) and !empty($question->options->shuffleanswers)) { $answerids = swapshuffle($answerids); } $state->options->order = $answerids; -- 2.39.5