mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code cleanup.
This commit is contained in:
@@ -35,19 +35,19 @@ class Income
|
||||
public function addOrCreateIncome(TransactionJournal $entry)
|
||||
{
|
||||
|
||||
$id = $entry->account_id;
|
||||
if (!$this->incomes->has($id)) {
|
||||
$accountId = $entry->account_id;
|
||||
if (!$this->incomes->has($accountId)) {
|
||||
$newObject = new stdClass;
|
||||
$newObject->amount = floatval($entry->queryAmount);
|
||||
$newObject->name = $entry->name;
|
||||
$newObject->count = 1;
|
||||
$newObject->id = $id;
|
||||
$this->incomes->put($id, $newObject);
|
||||
$newObject->id = $accountId;
|
||||
$this->incomes->put($accountId, $newObject);
|
||||
} else {
|
||||
$existing = $this->incomes->get($id);
|
||||
$existing = $this->incomes->get($accountId);
|
||||
$existing->amount += floatval($entry->queryAmount);
|
||||
$existing->count++;
|
||||
$this->incomes->put($id, $existing);
|
||||
$this->incomes->put($accountId, $existing);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user