Skip to content

Commit

Permalink
[fix] Numeric comparaison with Expression
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed May 17, 2016
1 parent f812d6b commit b6d8c83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Some user think ergonomy of LimeSurvey 2.50 is not better than 2.06 version. But


## Improvement and history ##
* 1.0.15
* 1.0.15/1.0.16
* Fix bad comparaison of Number (again)
* 1.0.14
* Add cssclass attribute : allow to manage more easily any plugins for question
Expand Down
2 changes: 1 addition & 1 deletion application/config/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

$config['versionnumber'] = "2.06+ SondagesPro";
$config['dbversionnumber'] = 184;
$config['buildnumber'] = '160510 - 1.0.15';
$config['buildnumber'] = '160510 - 1.0.16';
$config['updatable'] = false;

return $config;
6 changes: 3 additions & 3 deletions application/helpers/expressions/em_core_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ private function RDP_EvaluateBinary(array $token)
/* Don't return true always : user can enter non numeric value in a numeric value : we must compare as string then */
$arg1[0]=($arg1[2]=="NUMBER" && strpos($arg1[0],".")) ? rtrim(rtrim($arg1[0],"0"),".") : $arg1[0];
$arg2[0]=($arg2[2]=="NUMBER" && strpos($arg2[0],".")) ? rtrim(rtrim($arg2[0],"0"),".") : $arg2[0];
$bNumericArg1 = $arg1[0]==='' || strval(floatval($arg1[0]))==strval($arg1[0]);
$bNumericArg2 = $arg2[0]==='' || strval(floatval($arg2[0]))===strval($arg2[0]);
$bNumericArg1 = !$arg1[0] || strval(floatval($arg1[0]))==strval($arg1[0]);
$bNumericArg2 = !$arg2[0] || strval(floatval($arg2[0]))==strval($arg2[0]);

$bStringArg1 = !$arg1[0] || !$bNumericArg1;
$bStringArg2 = !$arg1[0] || !$bNumericArg2;
$bStringArg2 = !$arg2[0] || !$bNumericArg2;

$bBothNumeric = ($bNumericArg1 && $bNumericArg2);
$bBothString = ($bStringArg1 && $bStringArg2);
Expand Down

0 comments on commit b6d8c83

Please sign in to comment.