From 7948058364a05f501be947e02950418e4c9ccf06 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 5 Apr 2020 07:14:17 +0200 Subject: [PATCH] Fix #3234 --- app/Support/Export/ExportDataGenerator.php | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php index 28de5928c7..80264b3ebc 100644 --- a/app/Support/Export/ExportDataGenerator.php +++ b/app/Support/Export/ExportDataGenerator.php @@ -659,7 +659,7 @@ class ExportDataGenerator $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user); $collector->setRange($this->start, $this->end)->withAccountInformation()->withCategoryInformation()->withBillInformation() - ->withBudgetInformation(); + ->withBudgetInformation()->withTagInformation(); $journals = $collector->getExtractedJournals(); $records = []; @@ -689,8 +689,9 @@ class ExportDataGenerator $journal['category_name'], $journal['budget_name'], $journal['bill_name'], - implode(',', $journal['tags']), + $this->mergeTags($journal['tags']), ]; + } //load the CSV document from a string @@ -705,4 +706,22 @@ class ExportDataGenerator return $csv->getContent(); //returns the CSV document as a string } + /** + * @param array $tags + * + * @return string + */ + private function mergeTags(array $tags): string + { + if (0 === count($tags)) { + return ''; + } + $smol = []; + foreach ($tags as $tag) { + $smol[] = $tag['name']; + } + + return implode(',', $smol); + } + }