Skip to content

Commit

Permalink
Merge pull request #232 from gabrieljenik/patch-3
Browse files Browse the repository at this point in the history
Fixed issue #9026: If empty survey, export 1 empty record to avoid blank...
  • Loading branch information
c-schmitz committed Nov 5, 2014
2 parents 607c48c + 843a2a2 commit 07e6d92
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions application/helpers/admin/export/Writer.php
Expand Up @@ -275,6 +275,18 @@ final public function write(SurveyObj $oSurvey, $sLanguageCode, FormattingOption
}
//Output the results.
$sFile='';

// If empty survey, prepare an empty responses array, and output just 1 empty record with header.
if ($oSurvey->responses->rowCount == 0)
{
foreach ($oOptions->selectedColumns as $column)
{
$elementArray[]="";
}
$this->outputRecord($headers, $elementArray, $oOptions);
}

// If no empty survey, render/export responses array.
foreach($oSurvey->responses as $response)
{
$elementArray = array();
Expand Down

0 comments on commit 07e6d92

Please sign in to comment.