Skip to content

Firefly III: a personal finances manager

Should fix the last issues.

James Coleaf13d1943fcf
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 447bb4adbf..9bf61a3099 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -406,7 +406,7 @@ class AccountRepository implements AccountRepositoryInterface
'iban' => '',
];
$opposing = $this->storeAccount($opposingData);
- if (!is_null($opposing)) {
+ if (!is_null($opposing) && !is_null($newAccount)) {
$this->storeInitialBalance($newAccount, $opposing, $data);
}
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index 4bf1e742c4..ae1882b4f9 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -248,7 +248,7 @@ class JournalRepository implements JournalRepositoryInterface
}
// store accounts (depends on type)
- list($from, $to) = $this->storeAccounts($journal->transactionType, $data);
+ list($fromAccount, $toAccount) = $this->storeAccounts($journal->transactionType, $data);
// update the from and to transaction.
/** @var Transaction $transaction */
@@ -256,12 +256,12 @@ class JournalRepository implements JournalRepositoryInterface
if (floatval($transaction->amount) < 0) {
// this is the from transaction, negative amount:
$transaction->amount = $data['amount'] * -1;
- $transaction->account_id = $from->id;
+ $transaction->account_id = $fromAccount->id;
$transaction->save();
}
if (floatval($transaction->amount) > 0) {
$transaction->amount = $data['amount'];
- $transaction->account_id = $to->id;
+ $transaction->account_id = $toAccount->id;
$transaction->save();
}
}