Skip to content

Commit

Permalink
Fixed issue #6709: Export results - token values missing
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Oct 16, 2012
1 parent 13ae777 commit 74f3751
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions application/helpers/admin/exportresults_helper.php
Expand Up @@ -305,9 +305,9 @@ public function loadSurveyResults(SurveyObj $survey, $iLimit, $iOffset, $iMaximu
{

$oRecordSet = Yii::app()->db->createCommand()->select()->from('{{survey_' . $survey->id . '}}');
if (tableExists('tokens_'.$survey->id) && in_array('token',Survey_dynamic::model($survey->id)->attributes))
if (tableExists('tokens_'.$survey->id) && array_key_exists ('token',Survey_dynamic::model($survey->id)->attributes))
{
$oRecordSet->join('{{tokens_' . $survey->id . '}}','{{tokens_' . $survey->id . '}}.token={{survey_' . $survey->id . '}}.token');
$oRecordSet->leftJoin('{{tokens_' . $survey->id . '}}','{{tokens_' . $survey->id . '}}.token={{survey_' . $survey->id . '}}.token');
}
if ($sFilter!='')
$oRecordSet->where($sFilter);
Expand Down Expand Up @@ -1278,18 +1278,22 @@ final public function write(SurveyObj $survey, $sLanguageCode, FormattingOptions
foreach ($oOptions->selectedColumns as $column)
{
$value = $response[$column];

switch ($oOptions->answerFormat) {
case 'long':
$elementArray[] = $this->transformResponseValue($survey->getFullAnswer(
$column, $value, $this->translator, $this->languageCode),
$survey->fieldMap[$column]['type'], $oOptions);
break;
default:
case 'short':
$elementArray[] = $this->transformResponseValue($value,
$survey->fieldMap[$column]['type'], $oOptions);
break;
if (isset($survey->fieldMap[$column]))
{
switch ($oOptions->answerFormat) {
case 'long':
$elementArray[] = $this->transformResponseValue($survey->getFullAnswer($column, $value, $this->translator, $this->languageCode), $survey->fieldMap[$column]['type'], $oOptions);
break;
default:
case 'short':
$elementArray[] = $this->transformResponseValue($value,
$survey->fieldMap[$column]['type'], $oOptions);
break;
}
}
else //Token table value
{
$elementArray[]=$value;
}
}

Expand Down

0 comments on commit 74f3751

Please sign in to comment.