Skip to content

Commit 62c804c

Browse files
committed
Fix headers in flat list aggregations
Fixes #678
1 parent 5827d73 commit 62c804c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

meta/AggregationList.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,16 @@ protected function renderNode(NestedValue $node)
8989
*/
9090
protected function renderListItem($resultrow, $depth, $showEmpty = false)
9191
{
92-
$sepbyheaders = $this->searchConfig->getConf()['sepbyheaders'];
93-
$headers = $this->searchConfig->getConf()['headers'];
92+
$config = $this->searchConfig->getConf();
93+
$sepbyheaders = $config['sepbyheaders'];
94+
$headers = $config['headers'];
9495

9596
foreach ($resultrow as $index => $value) {
96-
$column = $index + $depth; // the resultrow is shifted by the nesting depth
97+
// when nesting, the resultrow is shifted by the nesting depth
98+
$column = $index;
99+
if ($config['nesting']) {
100+
$column += $depth;
101+
}
97102
if ($sepbyheaders && !empty($headers[$column])) {
98103
$header = $headers[$column];
99104
} else {

meta/ConfigParser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,14 @@ protected function parseValues($line)
279279
$value = '';
280280
$len = strlen($line);
281281
for ($i = 0; $i < $len; $i++) {
282-
if ($line[$i] == '"') {
282+
if ($line[$i] === '"') {
283283
if ($inQuote) {
284284
if ($escapedQuote) {
285285
$value .= '"';
286286
$escapedQuote = false;
287287
continue;
288288
}
289-
if ($line[$i + 1] == '"') {
289+
if (isset($line[$i + 1]) && $line[$i + 1] === '"') {
290290
$escapedQuote = true;
291291
continue;
292292
}
@@ -299,7 +299,7 @@ protected function parseValues($line)
299299
$value = ''; //don't store stuff before the opening quote
300300
continue;
301301
}
302-
} elseif ($line[$i] == ',') {
302+
} elseif ($line[$i] === ',') {
303303
if ($inQuote) {
304304
$value .= ',';
305305
continue;

0 commit comments

Comments
 (0)