Skip to content

Commit

Permalink
Merge pull request #97 from mfaber/printanswers
Browse files Browse the repository at this point in the history
Fixex issue #8013: 'printanswershonorsconditions' does not work
  • Loading branch information
mennodekker committed Jul 30, 2013
2 parents d60709b + 259e955 commit 4eb637c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions application/config/config-defaults.php
Expand Up @@ -60,6 +60,7 @@

// Site Settings
$config['dropdownthreshold'] = '25'; // The number of answers to a list type question before it switches from Radio Buttons to List
$config['printanswershonorsconditions'] = 1; // If set to 1, only relevant answers to questions can be printed by user. If set to 0, also questions not shown are printed

// Only applicable, of course, if you have chosen 'R' for $dropdowns and/or $lwcdropdowns
$config['repeatheadings'] = '25'; // The number of answers to show before repeating the headings in array (flexible) questions. Set to 0 to turn this feature off
Expand Down
3 changes: 2 additions & 1 deletion application/controllers/PrintanswersController.php
Expand Up @@ -136,7 +136,8 @@ function actionView($surveyid,$printableexport=FALSE)
// Since all data are loaded, and don't need JavaScript, pretend all from Group 1
LimeExpressionManager::StartProcessingGroup(1,($thissurvey['anonymized']!="N"),$surveyid);

$aFullResponseTable = getFullResponseTable($surveyid,$id,$language,true);
$printanswershonorsconditions = Yii::app()->getConfig('printanswershonorsconditions');
$aFullResponseTable = getFullResponseTable($surveyid,$id,$language,$printanswershonorsconditions);

//Get the fieldmap @TODO: do we need to filter out some fields?
unset ($aFullResponseTable['id']);
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/common_helper.php
Expand Up @@ -6013,7 +6013,7 @@ function getQuotaCompletedCount($iSurveyId, $quotaid)
* @param mixed $sLanguageCode
* @param boolean $bHonorConditions Apply conditions
*/
function getFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonorConditions=false)
function getFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonorConditions=true)
{
$aFieldMap = createFieldMap($iSurveyID,'full',false,false,$sLanguageCode);
$oLanguage = new Limesurvey_lang($sLanguageCode);
Expand All @@ -6026,7 +6026,7 @@ function getFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonorC

foreach ($aFieldMap as $sKey=>$fname)
{
if (LimeExpressionManager::QuestionIsRelevant($fname['qid']))
if (LimeExpressionManager::QuestionIsRelevant($fname['qid']) || $bHonorConditions==false)
{
$aRelevantFields[$sKey]=$fname;
}
Expand All @@ -6052,7 +6052,7 @@ function getFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonorC
if ($oldgid !== $fname['gid'])
{
$oldgid = $fname['gid'];
if (LimeExpressionManager::GroupIsRelevant($fname['gid'])) {
if (LimeExpressionManager::GroupIsRelevant($fname['gid']) || $bHonorConditions==false) {
$aResultTable['gid_'.$fname['gid']]=array($fname['group_name']);
}
}
Expand Down

0 comments on commit 4eb637c

Please sign in to comment.