From d6388d0acf3938108bbb60ea530cf6f6b3a88b03 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 5 Dec 2018 17:04:05 +0000 Subject: [PATCH] MDL-64332 questions: idnumber should not prevent easy duplication --- question/question.php | 1 + question/tests/behat/copy_questions.feature | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/question/question.php b/question/question.php index 0f78fc79109..a37d4199337 100644 --- a/question/question.php +++ b/question/question.php @@ -178,6 +178,7 @@ if ($id) { if ($makecopy) { // If we are duplicating a question, add some indication to the question name. $question->name = get_string('questionnamecopy', 'question', $question->name); + $question->idnumber = null; $question->beingcopied = true; } diff --git a/question/tests/behat/copy_questions.feature b/question/tests/behat/copy_questions.feature index 7ae37082c6b..e6e60967137 100644 --- a/question/tests/behat/copy_questions.feature +++ b/question/tests/behat/copy_questions.feature @@ -18,8 +18,8 @@ Feature: A teacher can duplicate questions in the question bank | contextlevel | reference | name | | Course | C1 | Test questions | And the following "questions" exist: - | questioncategory | qtype | name | questiontext | - | Test questions | essay | Test question to be copied | Write about whatever you want | + | questioncategory | qtype | name | questiontext | idnumber | + | Test questions | essay | Test question to be copied | Write about whatever you want | qid | And I log in as "teacher1" And I am on "Course 1" course homepage And I navigate to "Question bank > Questions" in current page administration