mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 09:22:33 +00:00
Make sure amounts are always positive.
This commit is contained in:
@@ -274,14 +274,11 @@ class TransactionGroupTransformer extends AbstractTransformer
|
|||||||
$row = new NullArrayObject($transaction);
|
$row = new NullArrayObject($transaction);
|
||||||
|
|
||||||
// amount:
|
// amount:
|
||||||
$type = $row['transaction_type_type'] ?? TransactionType::WITHDRAWAL;
|
$type = $row['transaction_type_type'] ?? TransactionType::WITHDRAWAL;
|
||||||
$amount = $row['amount'] ?? '0';
|
$amount = app('steam')->positive($row['amount'] ?? '0');
|
||||||
if (TransactionType::WITHDRAWAL !== $type) {
|
|
||||||
$amount = bcmul($amount, '-1');
|
|
||||||
}
|
|
||||||
$foreignAmount = null;
|
$foreignAmount = null;
|
||||||
if (null !== $row['foreign_amount']) {
|
if (null !== $row['foreign_amount']) {
|
||||||
$foreignAmount = TransactionType::WITHDRAWAL !== $type ? bcmul($row['foreign_amount'], '-1') : $row['foreign_amount']; // @codeCoverageIgnore
|
$foreignAmount = app('steam')->positive($row['foreign_amount']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$metaFieldData = $this->groupRepos->getMetaFields((int)$row['transaction_journal_id'], $this->metaFields);
|
$metaFieldData = $this->groupRepos->getMetaFields((int)$row['transaction_journal_id'], $this->metaFields);
|
||||||
|
Reference in New Issue
Block a user