Skip to content

Commit

Permalink
Fixed issue : Error after reordering a question used in condition
Browse files Browse the repository at this point in the history
Dev: use Question::model()->findByPk()
  • Loading branch information
sieutruc committed Oct 23, 2015
1 parent f4e1087 commit e64a3b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
3 changes: 2 additions & 1 deletion application/controllers/admin/surveyadmin.php
Expand Up @@ -1027,7 +1027,8 @@ private function _reorderGroup($iSurveyID)
$gid = (int)substr($parent, 1);
if (!isset($questionorder[$gid]))
$questionorder[$gid] = 0;
$question = Question::model()->getQuestionById($qid);
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
$question = Question::model()->findByPk(array("qid"=>$qid,'language'=>$sBaseLanguage));
$oldgid = $question['gid'];
if($oldgid != $gid) {
fixMovedQuestionConditions($qid,$oldgid,$gid,$iSurveyID);
Expand Down
10 changes: 0 additions & 10 deletions application/models/Question.php
Expand Up @@ -266,16 +266,6 @@ public function getAdvancedSettingsWithValues($iQuestionID, $sQuestionType, $iSu
return $aAttributeNames;
}

function getQuestionById($qid)
{
return Yii::app()->db->createCommand()
->select()
->from(self::tableName())
->where('qid=:qid')
->bindParam(":qid", $qid, PDO::PARAM_INT)
->queryRow();
}

function getQuestions($sid, $gid, $language)
{
return Yii::app()->db->createCommand()
Expand Down

0 comments on commit e64a3b6

Please sign in to comment.