Skip to content

Commit

Permalink
This fix a problem when importing questions.
Browse files Browse the repository at this point in the history
In multiple language surveys the qid was not the same for each language entry that caused that the attributes seemed not being imported (they were in the DB but with the wrong qid).

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/stable_plus@3513 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Gustavo San Roman committed Oct 30, 2007
1 parent ec8f5a2 commit 0f74d73
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions admin/importquestion.php
Expand Up @@ -329,8 +329,13 @@
$oldqid = $questionrowdata['qid'];
$oldsid = $questionrowdata['sid'];
$oldgid = $questionrowdata['gid'];
// Remove qid field
unset($questionrowdata['qid']);

// Remove qid field if there is no newqid; and set it to newqid if it's set
if (!isset($newqid))
unset($questionrowdata['qid']);
else
$questionrowdata['qid'] = $newqid;

$questionrowdata["sid"] = $newsid;
$questionrowdata["gid"] = $newgid;

Expand All @@ -357,7 +362,11 @@
$newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly
$qinsert = "insert INTO {$dbprefix}questions (".implode(',',array_keys($questionrowdata)).") VALUES (".implode(',',$newvalues).")";
$qres = $connect->Execute($qinsert) or die ("<strong>".$clang->gT("Error")."</strong> Failed to insert question<br />\n$qinsert<br />\n".$connect->ErrorMsg()."</body>\n</html>");
$newqid=$connect->Insert_ID();

// set the newqid only if is not set
if (!isset($newqid))
$newqid=$connect->Insert_ID();

$newrank=0;
//NOW DO NESTED ANSWERS FOR THIS QID
if (isset($answerarray) && $answerarray) {
Expand Down

0 comments on commit 0f74d73

Please sign in to comment.