Skip to content

Commit

Permalink
Fixed issue #9507: Admin GUI: Decimal format in answers pdf export ev…
Browse files Browse the repository at this point in the history
…en for 'only intenger' numeric questions
  • Loading branch information
Aestu committed Feb 9, 2015
1 parent 4c30dce commit 98e9ecc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion application/helpers/admin/export/PdfWriter.php
Expand Up @@ -70,7 +70,16 @@ public function outputRecord($headers, $values, FormattingOptions $oOptions)
{
if (isset($values[$question['index']]) && isset($headers[$question['index']]))
{
$this->pdf->addAnswer($headers[$question['index']], $values[$question['index']], false);
$qidattributes = getQuestionAttributeValues($question['qid']);
if (isset($qidattributes['num_value_int_only']) && trim($qidattributes['num_value_int_only']) == "1")
{
$sAuxValue=number_format(floatval($values[$question['index']]), 0, '', '');
$this->pdf->addAnswer($headers[$question['index']], $sAuxValue, false);
}
else
{
$this->pdf->addAnswer($headers[$question['index']], $values[$question['index']], false);
}
}
}
}
Expand Down

4 comments on commit 98e9ecc

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Aestu
Copy link
Collaborator Author

@Aestu Aestu commented on 98e9ecc Feb 10, 2015

Choose a reason for hiding this comment

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

I chose the most conservative option. I think we shouldn't remove 0s from string fields. Imagine, for example, a ID code 1234.4567.000. About numerical fields in general (not integer only) I'm not sure.

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't have question type ? Must be apply only to numerical and multi_numerical. You're sure for 2.06 ? DB type is not DECIMAL ?

@Aestu
Copy link
Collaborator Author

@Aestu Aestu commented on 98e9ecc Feb 10, 2015

Choose a reason for hiding this comment

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

Done:

3b1ae46

Version 2.06 works fine, I tested it again.

Please sign in to comment.