Skip to content

Commit

Permalink
Fixed issue #6652: Question type Array not working on MSSQL
Browse files Browse the repository at this point in the history
Dev Partial fix - much more work needed. See http://bugs.limesurvey.org/view.php?id=6625 for details on the problem
  • Loading branch information
c-schmitz committed Oct 3, 2012
1 parent 5210185 commit 670f352
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions application/helpers/qanda_helper.php
Expand Up @@ -4823,7 +4823,6 @@ function do_array($ia)
$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'];
$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";

$aQuestionAttributes = getQuestionAttributeValues($ia[0], $ia[4]);
if (trim($aQuestionAttributes['answer_width'])!='')
Expand All @@ -4850,13 +4849,14 @@ function do_array($ia)
$repeatheadings = intval($aQuestionAttributes['repeat_headings']);
$minrepeatheadings = 0;
}
$lresult = dbExecuteAssoc($lquery); //Checked
if ($useDropdownLayout === false && $lresult->count() > 0)

$lresult= Answers::model()->findAll(array('order'=>'sortorder, code', 'condition'=>'qid=:qid AND language=:language AND scale_id=0', 'params'=>array(':qid'=>$ia[0],':language'=>$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang'])));
if ($useDropdownLayout === false && count($lresult) > 0)
{
foreach ($lresult->readAll() as $lrow)
foreach ($lresult as $lrow)
{
$labelans[]=$lrow['answer'];
$labelcode[]=$lrow['code'];
$labelans[]=$lrow->answer;
$labelcode[]=$lrow->code;
}

// $cellwidth=sprintf('%02d', $cellwidth);
Expand Down Expand Up @@ -5017,11 +5017,11 @@ function do_array($ia)

$answer = $answer_start . $answer_cols . $answer_head .$answer ."</table>\n";
}
elseif ($useDropdownLayout === true && $lresult->count() > 0)
elseif ($useDropdownLayout === true && count($lresult)> 0)
{
foreach($lresult->readAll() as $lrow)
$labels[]=Array('code' => $lrow['code'],
'answer' => $lrow['answer']);
foreach($lresult as $lrow)
$labels[]=Array('code' => $lrow->code,
'answer' => $lrow->answer);
$ansquery = "SELECT question FROM {{questions}} WHERE parent_qid={$ia[0]} AND question like '%|%' ";
$ansresult = dbExecuteAssoc($ansquery); //Checked
if ($ansresult->count()>0) {$right_exists=true;$answerwidth=$answerwidth/2;} else {$right_exists=false;}
Expand Down

0 comments on commit 670f352

Please sign in to comment.