Skip to content

Commit

Permalink
Fixed issue #14142: Integer values in pdf report in multiple numerica…
Browse files Browse the repository at this point in the history
…l input

Dev: same fix than all at all other part … (qanda, export etc …)
Dev: think except with null : we don't have to test . since it's DECIMAL
  • Loading branch information
Shnoulle committed Oct 15, 2018
1 parent 83c1e67 commit c95a75c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions application/models/SurveyDynamic.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,6 @@ public function getQuestionArray($oQuestion, $oResponses, $bHonorConditions, $su
}

$fieldname = $oQuestion->basicFieldName;

//If question is of any Array-Type or a subquestion
if (in_array($oQuestion->type, ["F", "A", "B", "E", "C", "H", "Q", "K", "M", "P", ";",":","1"])
|| ($oQuestion->type=='T' && $oQuestion->parent_qid != 0)
Expand Down Expand Up @@ -871,8 +870,10 @@ public function getQuestionArray($oQuestion, $oResponses, $bHonorConditions, $su
}
}

if ($oQuestion->type=='N' && isset($attributes['num_value_int_only']) && $attributes['num_value_int_only'] == 1) {
$aQuestionAttributes['answervalue'] = number_format($aQuestionAttributes['answervalue'], 0, '', '');
if ($oQuestion->type=='N' || ($oQuestion->parent_qid != 0 && $oQuestion->parents['type'] === "K")) {
if (strpos($sValue, ".") !== false) { // Remove last 0 and last . ALWAYS (see \SurveyObj\getShortAnswer)
$aQuestionAttributes['answervalue'] = rtrim(rtrim($aQuestionAttributes['answervalue'], "0"), ".");
}
}

return $aQuestionAttributes;
Expand Down

0 comments on commit c95a75c

Please sign in to comment.