From 877e76469428b71db052dcfa71f7ec052be3b160 Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Tue, 11 Jun 2024 08:18:40 +0000 Subject: [PATCH] * [bug#50569,done,0.5h] fix columnTotal. --- module/pivot/zen.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module/pivot/zen.php b/module/pivot/zen.php index 5786dadd14..c0a8798093 100644 --- a/module/pivot/zen.php +++ b/module/pivot/zen.php @@ -259,7 +259,9 @@ class pivotZen extends pivot $index++; } - $lastRow = count($data->array) - 1; + $lastRow = count($data->array) - 1; + $hasGroup = $data->groups; + $hasColumnTotal = !empty($data->columnTotal) && $data->columnTotal != 'noShow'; foreach($data->array as $rowKey => $rowData) { $index = 0; @@ -292,7 +294,9 @@ class pivotZen extends pivot $cellSpan[$field]['rowspan'] = $field . '_rowspan'; } - if($i == 0 && !empty($data->groups) && !empty($data->columnTotal) && $rowKey == $lastRow) + $isFirstColumnAndLastRow = $i === 0 && $rowKey === $lastRow; + + if($isFirstColumnAndLastRow && $hasGroup && $hasColumnTotal) { $rows[$rowKey][$field . '_colspan'] = count($data->groups); $cellSpan[$field]['colspan'] = $field . '_colspan';