Skip to content

Commit

Permalink
Fix issue: error when importing survey with insertians.
Browse files Browse the repository at this point in the history
Fix issue: error when importing CSV survey.


git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@12009 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Aaron Schmitz committed Jan 12, 2012
1 parent d90da19 commit 1af12b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion application/helpers/admin/import_helper.php
Expand Up @@ -3139,7 +3139,7 @@ function CSVImportSurvey($sFullFilepath,$iDesiredSurveyId=NULL,$bTranslateLinks=
$newqid="";
$qarowdata["qid"]=$aQIDReplacements[$qarowdata["qid"]];
unset($qarowdata["qaid"]);
Question_attributes::model()->insertRecords($qarowdata);
$result=Question_attributes::model()->insertRecords($qarowdata);
if ($result>0) {$importresults['question_attributes']++;}
}
}
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/common_helper.php
Expand Up @@ -6748,7 +6748,7 @@ function TranslateInsertansTags($newsid,$oldsid,$fieldnames)
$result=Answers::model()->oldNewInsertansTags($newsid,$oldsid);

//while ($qentry = $res->FetchRow())
foreach ($result->readAll() as $qentry)
foreach ($result as $qentry)
{
$answer = $qentry['answer'];
$code = $qentry['code'];
Expand Down
9 changes: 4 additions & 5 deletions application/models/Answers.php
Expand Up @@ -92,11 +92,10 @@ function getAnswerCode($qid, $code, $lang)

public function oldNewInsertansTags($newsid,$oldsid)
{
$sql = "SELECT a.qid, a.language, a.code, a.answer from {{answers}} as a INNER JOIN {{questions}} as b ON a.qid=b.qid WHERE b.sid=:newsid AND a.answer LIKE '%{INSERTANS::oldsidX%'";
return Yii::app()->db->createCommand($sql)
->bindParam(":newsid", $newsid, PDO::PARAM_INT)
->bindParam(":oldsid", $oldsid, PDO::PARAM_INT)
->query();
$criteria = new CDbCriteria;
$criteria->compare('questions.sid',$newsid);
$criteria->compare('answer','{INSERTANS::'.$oldsid.'X');
return $this->with('questions')->findAll($criteria);
}

public function updateRecord($data, $condition=FALSE)
Expand Down

0 comments on commit 1af12b7

Please sign in to comment.