Commit 838c4336 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[BUGFIX] Fix the MailQueue CSV output

parent b8cadb58
......@@ -202,7 +202,10 @@ class MailRepository extends AbstractRepository {
$queryBuilder->andWhere($queryBuilder->expr()->eq('template_name', $queryBuilder->createNamedParameter($filters['filterTemplate'])));
}
$queryBuilder->andWhere($queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter($filters['filterLanguage'])));
if ($filters['filterLanguage']) {
$queryBuilder->andWhere($queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter($filters['filterLanguage'])));
}
$constraintsOr = [];
if ($filters['filterSearch']) {
$search = $queryBuilder->createNamedParameter('%' . $filters['filterSearch'] . '%');
......
......@@ -87,7 +87,7 @@ class BackendService {
$offset = 0;
$first = TRUE;
$handle = fopen('php://output', 'wb+');
while ($offset + self::CSV_EXPORT_BATCH_SIZE <= $totalRows) {
do {
$doctrineQuery->setFirstResult($offset);
$doctrineQuery->setMaxResults(self::CSV_EXPORT_BATCH_SIZE);
$rows = $doctrineQuery->execute();
......@@ -102,45 +102,29 @@ class BackendService {
if (strpos($label, 'LLL:') === 0) {
$label = $GLOBALS['LANG']->sL($label);
}
$row[] = '"' . ($label ?: $field) . '"';
$row[] = $label ?: $field;
}
}
fwrite(
$handle, trim(
preg_replace(
'/\s\s+/', ' ', strip_tags(
implode(',', $row) . ';' . LF
)
)
)
);
fputcsv($handle, $row, ',');
}
$row = [];
foreach ($mail as $field => $value) {
if (!in_array($field, $ignoreFields, TRUE)) {
if (in_array($field, $dateFields, TRUE)) {
$row[] = '"' . ($value ? date('d.m.Y', $value) : '') . '"';
$row[] = $value ? date('d.m.Y', $value) : '';
} else {
$row[] = '"' . (string) $value . '"';
$row[] = (string) $value;
}
}
}
fwrite(
$handle, trim(
preg_replace(
'/\s\s+/', ' ', strip_tags(
implode(',', $row) . ';' . LF
)
)
)
);
fputcsv($handle, $row, ',');
}
$offset += self::CSV_EXPORT_BATCH_SIZE;
}
} while ($offset <= $totalRows);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment