Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Various fixes in report pages.
James Cole260b61129391
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.phpindex f11285e38c..5d9d9d9851 100644--- a/app/Repositories/Account/AccountRepository.php+++ b/app/Repositories/Account/AccountRepository.php@@ -301,8 +301,8 @@ class AccountRepository implements AccountRepositoryInterface}/**- * This method will call AccountRepositoryInterface::journalsInPeriod and get all deposits made by the given $accounts,- * as well as the transfers that move away from those $accounts. This is a slightly sharper selection+ * This method will call AccountRepositoryInterface::journalsInPeriod and get all deposits made to the given $accounts,+ * as well as the transfers that move away to those $accounts. This is a slightly sharper selection* than made by journalsInPeriod itself.** @param Collection $accountsdiff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.phpindex 1d5039ff3c..79fd4d6321 100644--- a/app/Repositories/Account/AccountRepositoryInterface.php+++ b/app/Repositories/Account/AccountRepositoryInterface.php@@ -108,8 +108,8 @@ interface AccountRepositoryInterfacepublic function getSavingsAccounts(Carbon $start, Carbon $end): Collection;/**- * This method will call AccountRepositoryInterface::journalsInPeriod and get all deposits made by the given $accounts,- * as well as the transfers that move away from those $accounts. This is a slightly sharper selection+ * This method will call AccountRepositoryInterface::journalsInPeriod and get all deposits made to the given $accounts,+ * as well as the transfers that move away to those $accounts. This is a slightly sharper selection* than made by journalsInPeriod itself.** @param Collection $accountsdiff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.phpindex d9a87005e3..64d63d416b 100644--- a/app/Repositories/Category/CategoryRepository.php+++ b/app/Repositories/Category/CategoryRepository.php@@ -11,7 +11,6 @@ use FireflyIII\User;use Illuminate\Database\Query\JoinClause;use Illuminate\Pagination\LengthAwarePaginator;use Illuminate\Support\Collection;-use Log;/*** Class CategoryRepository@@ -197,7 +196,7 @@ class CategoryRepository implements CategoryRepositoryInterface});// create paginator- $offset = ($page - 1) * $pageSize;+ $offset = ($page - 1) * $pageSize;$subSet = $complete->slice($offset, $pageSize)->all();$paginator = new LengthAwarePaginator($subSet, $complete->count(), $pageSize, $page);@@ -458,8 +457,13 @@ class CategoryRepository implements CategoryRepositoryInterface->distinct()->transactionTypes($types)->leftJoin(- 'transactions as t', function (JoinClause $join) {- $join->on('t.transaction_journal_id', '=', 'transaction_journals.id')->where('amount', '<', 0);+ 'transactions as source', function (JoinClause $join) {+ $join->on('source.transaction_journal_id', '=', 'transaction_journals.id')->where('source.amount', '<', 0);+ }+ )+ ->leftJoin(+ 'transactions as destination', function (JoinClause $join) {+ $join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')->where('destination.amount', '>', 0);});@@ -468,7 +472,9 @@ class CategoryRepository implements CategoryRepositoryInterface}if ($accounts->count() > 0) {$accountIds = $accounts->pluck('id')->toArray();- $query->whereIn('t.account_id', $accountIds);+ $set = join(', ', $accountIds);+ $query->whereRaw('(source.account_id in (' . $set . ') XOR destination.account_id in (' . $set . '))');+}if ($categories->count() > 0) {$categoryIds = $categories->pluck('id')->toArray();@@ -477,7 +483,7 @@ class CategoryRepository implements CategoryRepositoryInterface}// that should do it:- $first = strval($query->sum('t.amount'));+ $first = strval($query->sum('source.amount'));// then collection transactions (harder)$query = $this->user->transactions()diff --git a/resources/views/popup/list/journals.twig b/resources/views/popup/list/journals.twigindex 46b9e87680..705ae6eb51 100644--- a/resources/views/popup/list/journals.twig+++ b/resources/views/popup/list/journals.twig@@ -70,9 +70,6 @@{% if not hideCategory %}<td class="hidden-xs">{{ journalCategories(journal)|raw }}- {% if journal.categories[0] %}- <a href="{{ route('categories.show',journal.categories[0].id) }}">{{ journal.categories[0].name }}</a>- {% endif %}</td>{% endif %}</tr>