mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-25 16:31:15 -06:00
Fixed update transactions.
This commit is contained in:
parent
e26d2376fc
commit
ae1245abec
@ -267,13 +267,15 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
// update the from and to transaction.
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($journal->transactions()->get() as $transaction) {
|
||||
if ($transaction->account_id === $from->id) {
|
||||
if (floatval($transaction->amount) < 0) {
|
||||
// this is the from transaction, negative amount:
|
||||
$transaction->amount = $data['amount'] * -1;
|
||||
$transaction->amount = $data['amount'] * -1;
|
||||
$transaction->account_id = $from->id;
|
||||
$transaction->save();
|
||||
}
|
||||
if ($transaction->account_id === $to->id) {
|
||||
if (floatval($transaction->amount) > 0) {
|
||||
$transaction->amount = $data['amount'];
|
||||
$transaction->account_id = $to->id;
|
||||
$transaction->save();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user