Skip to content

Firefly III: a personal finances manager

Fixed some display bugs for split journals.

James Cole78f297e18f8f
diff --git a/app/Export/Collector/JournalExportCollector.php b/app/Export/Collector/JournalExportCollector.php
index 927869718b..b9bd7fe0ed 100644
--- a/app/Export/Collector/JournalExportCollector.php
+++ b/app/Export/Collector/JournalExportCollector.php
@@ -298,7 +298,7 @@ class JournalExportCollector extends BasicCollector implements CollectorInterfac
'transactions AS opposing', function (JoinClause $join) {
$join->on('opposing.transaction_journal_id', '=', 'transactions.transaction_journal_id')
->where('opposing.amount', '=', DB::raw('transactions.amount * -1'))
- ->where('transactions.identifier', '=', 'opposing.identifier');
+ ->where('transactions.identifier', '=', DB::raw('opposing.identifier'));
}
)
->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')
diff --git a/app/Helpers/Collector/JournalCollector.php b/app/Helpers/Collector/JournalCollector.php
index 3894133bdd..a3c0ad1397 100644
--- a/app/Helpers/Collector/JournalCollector.php
+++ b/app/Helpers/Collector/JournalCollector.php
@@ -541,12 +541,13 @@ class JournalCollector implements JournalCollectorInterface
$this->query->leftJoin(
'transactions as opposing', function (JoinClause $join) {
$join->on('opposing.transaction_journal_id', '=', 'transactions.transaction_journal_id')
- ->where('opposing.identifier', '=', 'transactions.identifier')
+ ->where('opposing.identifier', '=', DB::raw('transactions.identifier'))
->where('opposing.amount', '=', DB::raw('transactions.amount * -1'));
}
);
$this->query->leftJoin('accounts as opposing_accounts', 'opposing.account_id', '=', 'opposing_accounts.id');
$this->query->leftJoin('account_types as opposing_account_types', 'opposing_accounts.account_type_id', '=', 'opposing_account_types.id');
+ $this->query->whereNull('opposing.deleted_at');
$this->fields[] = 'opposing.account_id as opposing_account_id';
$this->fields[] = 'opposing_accounts.name as opposing_account_name';
diff --git a/app/Models/Account.php b/app/Models/Account.php
index 2b13ed17a5..efecd2fa28 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -15,6 +15,7 @@ namespace FireflyIII\Models;
use Carbon\Carbon;
use Crypt;
+use DB;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index e1cc7fa0f9..62a9add9c1 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -334,7 +334,7 @@ class BudgetRepository implements BudgetRepositoryInterface
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->leftJoin(
'transactions', function (JoinClause $join) {
- $join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '<', '0');
+ $join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '<', 0);
}
)
->where('transaction_journals.date', '>=', $start->format('Y-m-d'))
diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.php
index f4337eb8d6..d717fdbda5 100644
--- a/app/Repositories/Journal/JournalTasker.php
+++ b/app/Repositories/Journal/JournalTasker.php
@@ -74,34 +74,6 @@ class JournalTasker implements JournalTaskerInterface
public function getTransactionsOverview(TransactionJournal $journal): array
{
// get all transaction data + the opposite site in one list.
- /**
- * select
- *
- * source.id,
- * source.account_id,
- * source_accounts.name as account_name,
- * source_accounts.encrypted as account_encrypted,
- * source.amount,
- * source.description,
- *
- * destination.id as destination_id,
- * destination.account_id as destination_account_id,
- * destination_accounts.name as destination_account_name,
- * destination_accounts.encrypted as destination_account_encrypted
- *
- *
- * from transactions as source
- *
- * left join transactions as destination ON source.transaction_journal_id =
- * destination.transaction_journal_id AND source.amount = destination.amount * -1 AND source.identifier = destination.identifier
- * -- left join source account name:
- * left join accounts as source_accounts ON source.account_id = source_accounts.id
- * left join accounts as destination_accounts ON destination.account_id = destination_accounts.id
- *
- * where source.transaction_journal_id = 6600
- * and source.amount < 0
- * and source.deleted_at is null
- */
$set = $journal
->transactions()// "source"
->leftJoin(