Skip to content

Commit 8bbca25

Browse files
committed
Fix Table widget's emptyValue for numeric columns
1 parent e193e10 commit 8bbca25

File tree

5 files changed

+53
-51
lines changed

5 files changed

+53
-51
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Change Log
22

3-
## Version 6.6.2
3+
## Version 6.6.5
44
1. Fix KoolReport.js
5+
2. Add multiple join processes: `LeftJoin`, `RightJoin`, `FullJoin`
6+
3. Add multiple DataStore's join methods: `rightJoin()`, `fullJoin()`
7+
4. Fix Table widget's emptyValue for numeric columns
58

69
## Version 6.6.1
710
1. Fix KoolReport.js for chart export to work

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "koolreport/core",
3-
"version":"6.6.2",
3+
"version":"6.6.5",
44
"description": "An Open Source PHP Reporting Framework for easier and faster report delivery.",
55
"keywords": ["php reporting framework","php reporting tools","data processing","data visualization","charts and graphs"],
66
"homepage": "https://www.koolreport.com",

src/processes/FullJoin.php

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,50 @@
2929
* @license MIT License https://www.koolreport.com/license#mit-license
3030
* @link https://www.koolphp.net
3131
*/
32-
class FullJoin extends OuterJoin
32+
class FullJoin extends Join
3333
{
34+
/**
35+
* Handle on input end
36+
*
37+
* @return null
38+
*/
39+
protected function onInputEnd()
40+
{
41+
$containerBak = $this->container;
42+
foreach ($this->container[0]["data"] as $key => $rows) {
43+
if (isset($this->container[1]["data"][$key])) {
44+
foreach ($rows as $first) {
45+
foreach ($this->container[1]["data"][$key] as $second) {
46+
$this->next(array_merge($first, $second));
47+
}
48+
}
49+
unset($this->container[1]["data"][$key]);
50+
} else {
51+
foreach ($rows as $first) {
52+
foreach ($rows as $first) {
53+
$mergedRow = $first;
54+
foreach ($this->secondSideKeys as $k) {
55+
if (!isset($mergedRow[$k])) $mergedRow[$k] = null;
56+
}
57+
$this->next($mergedRow);
58+
}
59+
}
60+
}
61+
unset($this->container[0]["data"][$key]);
62+
}
63+
64+
$this->container = $containerBak;
65+
foreach ($this->container[1]["data"] as $key => $rows) {
66+
if (!isset($this->container[0]["data"][$key])) {
67+
foreach ($rows as $second) {
68+
foreach ($this->firstSideKeys as $k) {
69+
$mergedRow[$k] = null;
70+
}
71+
$mergedRow = array_merge($mergedRow, $second);
72+
$this->next($mergedRow);
73+
}
74+
}
75+
unset($this->container[1]["data"][$key]);
76+
}
77+
}
3478
}

src/processes/OuterJoin.php

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -29,51 +29,6 @@
2929
* @license MIT License https://www.koolreport.com/license#mit-license
3030
* @link https://www.koolphp.net
3131
*/
32-
class OuterJoin extends Join
33-
{
34-
/**
35-
* Handle on input end
36-
*
37-
* @return null
38-
*/
39-
protected function onInputEnd()
40-
{
41-
$containerBak = $this->container;
42-
foreach ($this->container[0]["data"] as $key => $rows) {
43-
if (isset($this->container[1]["data"][$key])) {
44-
foreach ($rows as $first) {
45-
foreach ($this->container[1]["data"][$key] as $second) {
46-
$this->next(array_merge($first, $second));
47-
}
48-
}
49-
unset($this->container[1]["data"][$key]);
50-
} else {
51-
foreach ($rows as $first) {
52-
foreach ($rows as $first) {
53-
$mergedRow = $first;
54-
foreach ($this->secondSideKeys as $k) {
55-
if (!isset($mergedRow[$k])) $mergedRow[$k] = null;
56-
}
57-
$this->next($mergedRow);
58-
}
59-
}
60-
}
61-
unset($this->container[0]["data"][$key]);
62-
}
63-
64-
$this->container = $containerBak;
65-
foreach ($this->container[1]["data"] as $key => $rows) {
66-
if (!isset($this->container[0]["data"][$key])) {
67-
foreach ($rows as $second) {
68-
foreach ($this->firstSideKeys as $k) {
69-
$mergedRow[$k] = null;
70-
}
71-
$mergedRow = array_merge($mergedRow, $second);
72-
$this->next($mergedRow);
73-
}
74-
}
75-
unset($this->container[1]["data"][$key]);
76-
}
77-
}
78-
32+
class OuterJoin extends FullJoin
33+
{
7934
}

src/widgets/koolphp/Table.tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
}
136136
?>
137137
<td rv="<?php echo (in_array(gettype($value),array("array")))?"":htmlspecialchars($value);?>" <?php echo ($tdStyle)?"style='$tdStyle'":""; ?> <?php if($tdClass){echo " class='".((gettype($tdClass)=="string")?$tdClass:$tdClass($row,$cKey))."'";} ?>>
138-
<?php echo Table::formatValue($value, $meta["columns"][$cKey], $row, $cKey);?>
138+
<?php echo isset($row[$cKey]) ? Table::formatValue($value, $meta["columns"][$cKey], $row, $cKey) : $this->emptyValue;?>
139139
</td>
140140
<?php
141141
}

0 commit comments

Comments
 (0)