Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Catch "no category" entries.
James Cole61b6e266da49
diff --git a/app/Repositories/Category/OperationsRepository.php b/app/Repositories/Category/OperationsRepository.phpindex e6fde5812a..fc44bb7eeb 100644--- a/app/Repositories/Category/OperationsRepository.php+++ b/app/Repositories/Category/OperationsRepository.php@@ -78,12 +78,19 @@ class OperationsRepository implements OperationsRepositoryInterfaceif (null === $categories || (null !== $categories && 0 === $categories->count())) {$collector->setCategories($this->getCategories());}+ $collector->withCategoryInformation();$journals = $collector->getExtractedJournals();$array = [];foreach ($journals as $journal) {- $currencyId = (int)$journal['currency_id'];- $categoryId = (int)$journal['category_id'];+ $currencyId = (int)$journal['currency_id'];+ $categoryId = (int)$journal['category_id'];+ $categoryName = (string)$journal['category_name'];++ // catch "no category" entries.+ if (0 === $categoryId) {+ $categoryName = (string)trans('firefly.no_category');+ }// info about the currency:$array[$currencyId] = $array[$currencyId] ?? [@@ -98,7 +105,7 @@ class OperationsRepository implements OperationsRepositoryInterface// info about the categories:$array[$currencyId]['categories'][$categoryId] = $array[$currencyId]['categories'][$categoryId] ?? ['id' => $categoryId,- 'name' => $journal['category_name'],+ 'name' => $categoryName,'transaction_journals' => [],];@@ -143,12 +150,19 @@ class OperationsRepository implements OperationsRepositoryInterfaceif (null === $categories || (null !== $categories && 0 === $categories->count())) {$collector->setCategories($this->getCategories());}+ $collector->withCategoryInformation();$journals = $collector->getExtractedJournals();$array = [];foreach ($journals as $journal) {$currencyId = (int)$journal['currency_id'];$categoryId = (int)$journal['category_id'];+ $categoryName = (string)$journal['category_name'];++ // catch "no category" entries.+ if (0 === $categoryId) {+ $categoryName = (string)trans('firefly.no_category');+ }// info about the currency:$array[$currencyId] = $array[$currencyId] ?? [@@ -163,7 +177,7 @@ class OperationsRepository implements OperationsRepositoryInterface// info about the categories:$array[$currencyId]['categories'][$categoryId] = $array[$currencyId]['categories'][$categoryId] ?? ['id' => $categoryId,- 'name' => $journal['category_name'],+ 'name' => $categoryName,'transaction_journals' => [],];