Skip to content

Commit

Permalink
Fixed issue #7622: Testing survey crashes when moving to group with m…
Browse files Browse the repository at this point in the history
…ultiple choice question
  • Loading branch information
c-schmitz committed Mar 2, 2013
1 parent abc9fc9 commit e083fa6
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions application/helpers/qanda_helper.php
Expand Up @@ -2254,8 +2254,7 @@ function do_multiplechoice($ia)
}

$qquery = "SELECT other FROM {{questions}} WHERE qid=".$ia[0]." AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."' and parent_qid=0";
$qresult = dbExecuteAssoc($qquery); //Checked
$qrow = $qresult->read(); $other = $qrow['other'];
$other = Yii::app()->db->createCommand($qquery)->queryScalar(); //Checked

if ($aQuestionAttributes['random_order']==1) {
$ansquery = "SELECT * FROM {{questions}} WHERE parent_qid=$ia[0] AND scale_id=0 AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."' ORDER BY ".dbRandom();
Expand Down Expand Up @@ -2639,8 +2638,7 @@ function do_multiplechoice_withcomments($ia)
// }

$qquery = "SELECT other FROM {{questions}} WHERE qid=".$ia[0]." AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."' and parent_qid=0";
$qresult = Yii::app()->db->createCommand($qquery)->query(); //Checked
$qrow = $qresult->read(); $other = $qrow['other'];
$other = Yii::app()->db->createCommand($qquery)->queryScalar(); //Checked
if ($aQuestionAttributes['random_order']==1) {
$ansquery = "SELECT * FROM {{questions}} WHERE parent_qid=$ia[0] AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."' ORDER BY ".dbRandom();
} else {
Expand Down Expand Up @@ -4398,8 +4396,7 @@ function do_array_10point($ia)
$checkconditionFunction = "checkconditions";

$qquery = "SELECT other FROM {{questions}} WHERE qid=".$ia[0]." AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."'";
$qresult = dbExecuteAssoc($qquery); //Checked
$qrow = $qresult->read(); $other = $qrow['other'];
$other = Yii::app()->db->createCommand($qquery)->queryScalar(); //Checked

$aQuestionAttributes = getQuestionAttributeValues($ia[0], $ia[4]);
if (trim($aQuestionAttributes['answer_width'])!='')
Expand Down Expand Up @@ -4843,8 +4840,7 @@ function do_array($ia)

$checkconditionFunction = "checkconditions";
$qquery = "SELECT other FROM {{questions}} WHERE qid={$ia[0]} AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."'";
$qresult = dbExecuteAssoc($qquery); //Checked
$qrow = $qresult->read(); $other = $qrow['other'];
$other = Yii::app()->db->createCommand($qquery)->queryScalar(); //Checked

$aQuestionAttributes = getQuestionAttributeValues($ia[0], $ia[4]);
if (trim($aQuestionAttributes['answer_width'])!='')
Expand Down Expand Up @@ -5206,9 +5202,8 @@ function do_array_multitext($ia)

$defaultvaluescript = "";
$qquery = "SELECT other FROM {{questions}} WHERE qid={$ia[0]} AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."'";

$qresult = Yii::app()->db->createCommand($qquery)->query();
$qrow = $qresult->read(); $other = $qrow['other'];
$other = Yii::app()->db->createCommand($qquery)->queryScalar(); //Checked


$aQuestionAttributes = getQuestionAttributeValues($ia[0], $ia[4]);

Expand Down Expand Up @@ -5369,8 +5364,7 @@ function do_array_multitext($ia)
$cellwidth=sprintf('%02d', $cellwidth);

$ansquery = "SELECT count(question) FROM {{questions}} WHERE parent_qid={$ia[0]} and scale_id=0 AND question like '%|%'";
$ansresult = dbExecuteAssoc($ansquery)->read();
$ansresult = reset($ansresult);
$ansresult = Yii::app()->db->createCommand($ansquery)->queryScalar(); //Checked
if ($ansresult>0)
{
$right_exists=true;
Expand Down Expand Up @@ -5572,8 +5566,7 @@ function do_array_multiflexi($ia)
//echo '<pre>'; print_r($_POST); echo '</pre>';
$defaultvaluescript = '';
$qquery = "SELECT other FROM {{questions}} WHERE qid=".$ia[0]." AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."' and parent_qid=0";
$qresult = dbExecuteAssoc($qquery);
$qrow = $qresult->read(); $other = $qrow['other'];
$other = Yii::app()->db->createCommand($qquery)->queryScalar(); //Checked

$aQuestionAttributes = getQuestionAttributeValues($ia[0], $ia[4]);
if (trim($aQuestionAttributes['multiflexible_max'])!='' && trim($aQuestionAttributes['multiflexible_min']) ==''){
Expand Down Expand Up @@ -5924,8 +5917,8 @@ function do_arraycolumns($ia)

$aQuestionAttributes = getQuestionAttributeValues($ia[0], $ia[4]);
$qquery = "SELECT other FROM {{questions}} WHERE qid=".$ia[0]." AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."'";
$qresult = dbExecuteAssoc($qquery); //Checked
$qrow = $qresult->read(); $other = $qrow['other'];
$other = Yii::app()->db->createCommand($qquery)->queryScalar(); //Checked

$lquery = "SELECT * FROM {{answers}} WHERE qid=".$ia[0]." AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."' and scale_id=0 ORDER BY sortorder, code";
$oAnswers = dbExecuteAssoc($lquery);
$aAnswers = $oAnswers->readAll();
Expand Down

0 comments on commit e083fa6

Please sign in to comment.