mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
This commit is contained in:
parent
94a3bb0443
commit
eed3902cb7
@ -102,7 +102,14 @@ class CorrectsNativeAmounts extends Command
|
|||||||
{
|
{
|
||||||
$set = $userGroup->accounts()->where(function (EloquentBuilder $q): void {
|
$set = $userGroup->accounts()->where(function (EloquentBuilder $q): void {
|
||||||
$q->whereNotNull('virtual_balance');
|
$q->whereNotNull('virtual_balance');
|
||||||
|
|
||||||
|
// this needs a different piece of code for postgres.
|
||||||
|
if ('pgsql' === config('database.default')) {
|
||||||
|
$q->orWhere(DB::raw('CAST(virtual_balance AS TEXT)'), '!=', '');
|
||||||
|
}
|
||||||
|
if ('pgsql' !== config('database.default')) {
|
||||||
$q->orWhere('virtual_balance', '!=', '');
|
$q->orWhere('virtual_balance', '!=', '');
|
||||||
|
}
|
||||||
})->get();
|
})->get();
|
||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
@ -218,7 +225,6 @@ class CorrectsNativeAmounts extends Command
|
|||||||
$set = DB::table('transactions')
|
$set = DB::table('transactions')
|
||||||
->join('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
->join('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||||
->where('transaction_journals.user_group_id', $userGroup->id)
|
->where('transaction_journals.user_group_id', $userGroup->id)
|
||||||
|
|
||||||
->where(function (DatabaseBuilder $q1) use ($currency): void {
|
->where(function (DatabaseBuilder $q1) use ($currency): void {
|
||||||
$q1->where(function (DatabaseBuilder $q2) use ($currency): void {
|
$q1->where(function (DatabaseBuilder $q2) use ($currency): void {
|
||||||
$q2->whereNot('transactions.transaction_currency_id', $currency->id)->whereNull('transactions.foreign_currency_id');
|
$q2->whereNot('transactions.transaction_currency_id', $currency->id)->whereNull('transactions.foreign_currency_id');
|
||||||
@ -231,8 +237,7 @@ class CorrectsNativeAmounts extends Command
|
|||||||
// ->whereNot('transactions.foreign_currency_id', $currency->id)
|
// ->whereNot('transactions.foreign_currency_id', $currency->id)
|
||||||
// ;
|
// ;
|
||||||
// })
|
// })
|
||||||
->get(['transactions.id'])
|
->get(['transactions.id']);
|
||||||
;
|
|
||||||
TransactionObserver::$recalculate = false;
|
TransactionObserver::$recalculate = false;
|
||||||
foreach ($set as $item) {
|
foreach ($set as $item) {
|
||||||
// here we are.
|
// here we are.
|
||||||
|
Loading…
Reference in New Issue
Block a user