mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fixed a bug where transfers away from a piggy bank's account would not properly reflect the piggy bank.
This commit is contained in:
@@ -65,6 +65,22 @@ class ConnectJournalToPiggyBank
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log::debug('Found rep! ' . $repetition->id);
|
Log::debug('Found rep! ' . $repetition->id);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add amount when
|
||||||
|
*/
|
||||||
|
/** @var Transaction $transaction */
|
||||||
|
foreach ($journal->transactions()->get() as $transaction) {
|
||||||
|
if ($transaction->account_id == $piggyBank->account_id) {
|
||||||
|
if ($transaction->amount < 0) {
|
||||||
|
$amount = $amount * -1;
|
||||||
|
Log::debug('Transaction is away from piggy, so amount becomes ' . $amount);
|
||||||
|
} else {
|
||||||
|
Log::debug('Transaction is to from piggy, so amount stays ' . $amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$repetition->currentamount += $amount;
|
$repetition->currentamount += $amount;
|
||||||
$repetition->save();
|
$repetition->save();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user