Skip to content

Commit

Permalink
Fixed Issue #11708: Question code not shown when 'Show question code …
Browse files Browse the repository at this point in the history
…only' is selected in survey settings
  • Loading branch information
mfavetti committed Sep 26, 2016
1 parent 64e9670 commit a5a3f1e
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -1489,17 +1489,17 @@ public static function getQuestionReplacement($aQuestionQanda)
$aReplacement['GID']=$aQuestionQanda[6];// Not sure for aleatory : it's the real gid or the updated gid ? We need original gid or updated gid ?
$aReplacement['SGQ']=$aQuestionQanda[7];
$aReplacement['AID']=isset($aQuestionQanda[0]['aid']) ? $aQuestionQanda[0]['aid'] : "" ;
$aReplacement['QUESTION_CODE']=$aReplacement['QUESTION_NUMBER']="";
$sCode=$aQuestionQanda[5];
$iNumber=$aQuestionQanda[0]['number'];

$showqnumcode_global_ = getGlobalSetting('showqnumcode');
$aSurveyinfo = getSurveyInfo($iSurveyId);
// Look up if there is a global Setting to hide/show the Questiongroup => In that case Globals will override Local Settings
if(($aSurveyinfo['showqnumcode'] == $showqnumcode_global_) || ($showqnumcode_global_ == 'choose')){
$showqnumcode_ = $aSurveyinfo['showqnumcode'];
} else {
$showqnumcode_ = $showqnumcode_global_;

// Check global setting to see if survey level setting should be applied
if($showqnumcode_global_ == 'choose') { // Use survey level settings
$showqnumcode_ = $aSurveyinfo['showqnumcode']; //B, N, C, or X
} else { // Use global setting
$showqnumcode_ = $showqnumcode_global_; //both, number, code, or none
}

switch ($showqnumcode_)
Expand All @@ -1510,15 +1510,20 @@ public static function getQuestionReplacement($aQuestionQanda)
$aReplacement['QUESTION_NUMBER']=$iNumber;
break;
case 'number':
case 'N':
case 'N': // Number only
$aReplacement['QUESTION_CODE']="";
$aReplacement['QUESTION_NUMBER']=$iNumber;
break;
case 'number':
case 'code':
case 'C': // Code only
$aReplacement['QUESTION_CODE']=$sCode;
$aReplacement['QUESTION_NUMBER']="";
break;
case 'choose':
case 'C':
default:
case 'none':
case 'X':
default: // Neither
$aReplacement['QUESTION_CODE']="";
$aReplacement['QUESTION_NUMBER']="";
break;
}

Expand Down

0 comments on commit a5a3f1e

Please sign in to comment.