mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-25 13:10:35 +00:00
Fix #4600
This commit is contained in:
@@ -203,7 +203,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
|||||||
];
|
];
|
||||||
|
|
||||||
$array[$currencyId]['transaction_journals'][$journalId] = [
|
$array[$currencyId]['transaction_journals'][$journalId] = [
|
||||||
'amount' => app('steam')->$direction($journal['amount']),
|
'amount' => app('steam')->$direction((string)$journal['amount']),
|
||||||
'date' => $journal['date'],
|
'date' => $journal['date'],
|
||||||
'transaction_journal_id' => $journalId,
|
'transaction_journal_id' => $journalId,
|
||||||
'budget_name' => $journal['budget_name'],
|
'budget_name' => $journal['budget_name'],
|
||||||
@@ -364,7 +364,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
|||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||||
];
|
];
|
||||||
$array[$key]['sum'] = bcadd($array[$key]['sum'], app('steam')->$method($journal['amount']));
|
$array[$key]['sum'] = bcadd($array[$key]['sum'], app('steam')->$method((string)$journal['amount']));
|
||||||
|
|
||||||
// also do foreign amount:
|
// also do foreign amount:
|
||||||
if (0 !== (int)$journal['foreign_currency_id']) {
|
if (0 !== (int)$journal['foreign_currency_id']) {
|
||||||
@@ -379,7 +379,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
|||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
'currency_decimal_places' => $journal['foreign_currency_decimal_places'],
|
'currency_decimal_places' => $journal['foreign_currency_decimal_places'],
|
||||||
];
|
];
|
||||||
$array[$key]['sum'] = bcadd($array[$key]['sum'], app('steam')->$method($journal['foreign_amount']));
|
$array[$key]['sum'] = bcadd($array[$key]['sum'], app('steam')->$method((string)$journal['foreign_amount']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class Steam
|
|||||||
$repository = app(AccountRepositoryInterface::class);
|
$repository = app(AccountRepositoryInterface::class);
|
||||||
$repository->setUser($account->user);
|
$repository->setUser($account->user);
|
||||||
|
|
||||||
$currencyId = (int)$repository->getMetaValue($account, 'currency_id');
|
$currencyId = (int)$repository->getMetaValue($account, 'currency_id');
|
||||||
$transactions = $account->transactions()
|
$transactions = $account->transactions()
|
||||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||||
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
|
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
|
||||||
@@ -493,6 +493,9 @@ class Steam
|
|||||||
*/
|
*/
|
||||||
public function negative(string $amount): string
|
public function negative(string $amount): string
|
||||||
{
|
{
|
||||||
|
if ('' === $amount) {
|
||||||
|
return '0';
|
||||||
|
}
|
||||||
if (1 === bccomp($amount, '0')) {
|
if (1 === bccomp($amount, '0')) {
|
||||||
$amount = bcmul($amount, '-1');
|
$amount = bcmul($amount, '-1');
|
||||||
}
|
}
|
||||||
@@ -554,6 +557,9 @@ class Steam
|
|||||||
*/
|
*/
|
||||||
public function positive(string $amount): string
|
public function positive(string $amount): string
|
||||||
{
|
{
|
||||||
|
if ('' === $amount) {
|
||||||
|
return '0';
|
||||||
|
}
|
||||||
if (bccomp($amount, '0') === -1) {
|
if (bccomp($amount, '0') === -1) {
|
||||||
$amount = bcmul($amount, '-1');
|
$amount = bcmul($amount, '-1');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user