Skip to content

Commit

Permalink
Fixed issue #17818: Copy a multiple choice question send a DB error (…
Browse files Browse the repository at this point in the history
…MSSQL) (#2593)

Dev: switchMSSQLIdentityInsert when needed
  • Loading branch information
Shnoulle committed Dec 2, 2022
1 parent e3755fe commit 5b08ca3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions application/controllers/admin/database.php
Expand Up @@ -1373,12 +1373,15 @@ private function actionInsertCopyQuestion($iSurveyID)
$aInsertData['qid'] = null;
} else { // additional languages
$aInsertData['qid'] = $aSubquestionIds[$sSubquestionIndex]; // get qid from array
switchMSSQLIdentityInsert('questions', true);
}

$aInsertData['parent_qid'] = $this->iQuestionID;
if (Question::model()->insertRecords($aInsertData)){
if ($sLanguageIndex == 0){ // main language
$aSubquestionIds[$sSubquestionIndex] = getLastInsertID('{{questions}}'); // save qid into the array
} else {
switchMSSQLIdentityInsert('questions', false);
}
}
}
Expand Down

0 comments on commit 5b08ca3

Please sign in to comment.