Some new tests and a bug fix for piggy banks.

This commit is contained in:
James Cole
2015-06-24 21:02:34 +02:00
parent 124c9303b9
commit 5160f2c298
4 changed files with 109 additions and 5 deletions

View File

@@ -51,9 +51,15 @@ class ConnectJournalToPiggyBank
if (is_null($repetition)) {
return false;
}
$amount = $journal->correct_amount;
bcscale(2);
$amount = $journal->actual_amount;
// if piggy account matches source account, the amount is positive
if ($piggyBank->account_id == $journal->source_account->id) {
$amount = $amount * -1;
}
$repetition->currentamount = bcadd($repetition->currentamount, $amount);
$repetition->save();

View File

@@ -9,6 +9,7 @@ use Zizaco\Entrust\Traits\EntrustUserTrait;
/**
* Class User
* @codeCoverageIgnore
*
* @package FireflyIII
* @property integer $id