Skip to content

Commit

Permalink
Fixed issue #08409: no zéro trim if value of numeric field is "0"
Browse files Browse the repository at this point in the history
Dev: only need to remove last 0 after dot due to decimal SQL
Dev: maybe better to do it elsewhere for 2.1 question plugins
  • Loading branch information
Shnoulle committed Nov 27, 2013
1 parent a9bc05a commit 083a196
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions application/helpers/qanda_helper.php
Expand Up @@ -3427,13 +3427,11 @@ function do_numerical($ia)
$fValue=$_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]];
$sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
$sSeparator = $sSeparator['separator'];
// 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 ?)
// Fix the display value : Value is stored as decimal in SQL then return dot and 0 after dot. Seems only for numerical question type
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 083a196

Please sign in to comment.