mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 15:39:50 +00:00
Fixed update transactions.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user