Skip to content
Permalink
Browse files

Fixed issue #14920: Export responses does not work for survey without…

… token table - patch #2
  • Loading branch information...
dominikvitt committed May 21, 2019
1 parent 8a0cf61 commit fc998ce97bc08b61e149a4242a8c91ffe148de9f
Showing with 7 additions and 5 deletions.
  1. +1 −1 application/helpers/admin/export/SurveyDao.php
  2. +6 −4 application/helpers/admin/export/Writer.php
@@ -43,7 +43,7 @@ public function loadSurveyById($id, $lang = null, FormattingOptions $oOptions =
$survey->groups = QuestionGroup::model()->findAll(array("condition" => 'sid='.$intId, 'order'=>'group_order'));
$survey->questions = Question::model()->findAll(array("condition" => 'sid='.$intId, 'order'=>'question_order'));
$aAnswers = Answer::model()->with(array('answerL10ns', 'question'), array('condition'=>'sid='.$intId.' AND language = "'.$lang.'"'))->findAll(array('order' => 'question.question_order, t.scale_id, sortorder'));
$aAnswers = Answer::model()->with('answerL10ns', 'question')->findAll(array('condition'=>'question.sid='.$intId.' AND answerL10ns.language = \''.$lang.'\'', 'order' => 'question.question_order, t.scale_id, sortorder'));
foreach ($aAnswers as $aAnswer) {
if(!empty($oOptions->stripHtmlCode) && $oOptions->stripHtmlCode == 1 && Yii::app()->controller->action->id !='remotecontrol'){
$answer=stripTagsFull($aAnswer->answerL10ns[$lang]->answer);
@@ -296,15 +296,17 @@ protected function transformResponseValue($value, $fieldType, FormattingOptions
foreach ($oSurvey->responses as $response) {
// prepare the data for decryption
$sTokenTableName='tokens_'.$oSurvey->id;
$aResponse = array();
if (tableExists($sTokenTableName)) {
$oToken = Token::model($oSurvey->id);
$oToken->setAttributes($response, false);
$oToken->decrypt();
$oResponse = Response::model($oSurvey->id);
$oResponse->setAttributes($response, false);
$oResponse->decrypt();
$aResponse = array_merge($oToken->attributes, $oResponse->attributes);
$aResponse = array_merge($aResponse, $oToken->attributes);
}
$oResponse = Response::model($oSurvey->id);
$oResponse->setAttributes($response, false);
$oResponse->decrypt();
$aResponse = array_merge($aResponse, $oResponse->attributes);
$elementArray = array();

0 comments on commit fc998ce

Please sign in to comment.
You can’t perform that action at this time.