Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue #08013: 'printanswershonorsconditions' does not work #97

Merged
merged 1 commit into from Jul 30, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to change default ? Seeing at top line : you send good boolean before .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $bHonorConditions was not used in the if-condition later on. (lines 6029/6055)
So, by default, the getFullResponseTable()-function behaved like $bHonorConditions was set to true. (By default, getFullResponseTable() only gave "relevant" answers).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes,

A function parameters not used .... it's really a bad issue .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will check if the function is called somewhere WITH this parameter in other files...so we do no get surprises.
I will also make the changes for 2.05 and issue another pull request, ok?

{
$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