Skip to content

Commit

Permalink
v2.43.0
Browse files Browse the repository at this point in the history
Fix: issue with GoogleChart when working with numeric column but in
string form.
  • Loading branch information
koolphp committed Apr 20, 2018
1 parent 8ae0551 commit 1bd1614
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "koolphp/koolreport",
"version":"2.42.0",
"version":"2.43.0",
"description": "An Open Source PHP Reporting Framework for easier and faster report delivery.",
"keywords": ["php reporting framework","php reporting tools","data processing","data visualization","charts and graphs"],
"homepage": "https://www.koolreport.com",
Expand Down
3 changes: 3 additions & 0 deletions koolreport/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Version 2.43.0
1. Fix issue with GoogleChart when working with numeric column but in string form.

# Version 2.42.0
1. Change namespace `::class` to use classname in string so that `KoolReport` is compatible with PHP 5.4
2. `PdoDataSource`: Fix `charset` issue with `PostgreSQL`
Expand Down
2 changes: 1 addition & 1 deletion koolreport/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "KoolReport",
"version":"2.42.0",
"version":"2.43.0",
"description": "An Open Source PHP Reporting Framework for easier and faster report delivery",
"keywords": ["php reporting framework","php reporting tools","data reporting","charts and graphs"],
"homepage": "https://www.koolreport.com",
Expand Down
5 changes: 4 additions & 1 deletion koolreport/processes/CalculatedColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,23 @@ protected function onMetaReceived($metaData)

protected function onInput($data)
{
// print_r($data);
$this->rowNum++;
foreach($this->params as $cKey=>$cValue)
{
switch(gettype($cValue["exp"]))
{
case "string":
$expression = $cValue["exp"];
// echo $expression . ' || ';
foreach($data as $k=>$v)
if (is_string($v) || is_numeric($v))
{
$expression = str_replace("{".$k."}",$v,$expression);
}
//predefined row
$expression = str_replace("{#}",$this->rowNum,$expression);

// echo $expression . ' <br> ';
eval('$data[$cKey]='.$expression.';');
break;
case "object":
Expand Down
14 changes: 10 additions & 4 deletions koolreport/widgets/google/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,18 @@ protected function prepareData()
$gRow = array();
foreach($columns as $cKey=>$cSetting)
{
$fValue = Utility::format($row[$cKey],$cSetting);
$value = $row[$cKey];
$cType = Utility::get($cSetting,"type","unknown");
if($cType==="number")
{
$value = floatval($value);
}
$fValue = Utility::format($value,$cSetting);

array_push($gRow,
($fValue===$row[$cKey])?
$row[$cKey]:
array("v"=>$row[$cKey],"f"=>$fValue)
($fValue===$value)?
$value:
array("v"=>$value,"f"=>$fValue)
);

foreach($columnExtraRoles as $cRole)
Expand Down

0 comments on commit 1bd1614

Please sign in to comment.