Skip to content

Commit

Permalink
Fixed issue #8385: right supression of '0' in print value of numeric …
Browse files Browse the repository at this point in the history
…field

Dev: did we really need to fix 0 value left and remove last dot ?
Dev: in 2.00 :$fValue=rtrim(rtrim($fValue,"0"),".");
  • Loading branch information
Shnoulle committed Nov 19, 2013
1 parent 7d73764 commit cb6f8c8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions application/helpers/qanda_helper.php
Expand Up @@ -3383,11 +3383,6 @@ function do_numerical($ia)
$tiwidth=10;
}

$fValue=$_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]];
if(strpos($fValue,"."))
{
$fValue=rtrim(rtrim($fValue,"0"),".");
}
if (trim($aQuestionAttributes['num_value_int_only'])==1)
{
$acomma="";
Expand All @@ -3406,9 +3401,16 @@ function do_numerical($ia)
$integeronly=0;
}

$fValue=$_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]];
$sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
$sSeparator = $sSeparator['separator'];
$fValue = rtrim(trim($fValue,"0"),".");
// Fix the display value : remove extra 0 left, extra 0 rigth after dot and remove dot if it's at end
// TODO : use a function and do it with other numeric question type or move it to EM (if we need to fix display value ?)
if(strpos($fValue,"."))
{
$fValue=rtrim(rtrim($fValue,"0"),".");
}
$fValue = ltrim($fValue,"0");
$fValue = str_replace('.',$sSeparator,$fValue);

if ($thissurvey['nokeyboard']=='Y')
Expand Down

0 comments on commit cb6f8c8

Please sign in to comment.