Skip to content

Commit

Permalink
Exercise: Fix additional issue in tests copy and restore where answer…
Browse files Browse the repository at this point in the history
…s are not restored and c_quiz_rel_question.question_id remains empty - refs BT#19143
  • Loading branch information
ywarnier committed Sep 9, 2021
1 parent dc4d2b7 commit 38432d1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php
Expand Up @@ -2026,10 +2026,15 @@ public function restore_quiz_question($id, $idColumn = true)

$new_id = Database::insert($table_que, $params);

if ($new_id && $idColumn) {
$sql = "UPDATE $table_que SET id = iid WHERE iid = $new_id";
Database::query($sql);
if ($new_id) {
// If the ID column is still present, update it, otherwise just
// continue
if ($idColumn) {
$sql = "UPDATE $table_que SET id = iid WHERE iid = $new_id";
Database::query($sql);
}
} else {
// If no IID was generated, stop right there and return 0
return 0;
}

Expand Down

0 comments on commit 38432d1

Please sign in to comment.