mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fixes #346
This commit is contained in:
parent
5540697dbd
commit
9920504232
@ -197,7 +197,7 @@ class VerifyDatabase extends Command
|
||||
$date = is_null($entry->transaction_deleted_at) ? $entry->journal_deleted_at : $entry->transaction_deleted_at;
|
||||
$this->error(
|
||||
'Error: Account #' . $entry->account_id . ' should have been deleted, but has not.' .
|
||||
' Find it in the table called `accounts` and change the `deleted_at` field to: "' . $date . '"'
|
||||
' Find it in the table called "accounts" and change the "deleted_at" field to: "' . $date . '"'
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -224,7 +224,7 @@ class VerifyDatabase extends Command
|
||||
foreach ($set as $entry) {
|
||||
$this->error(
|
||||
'Error: Transaction #' . $entry->transaction_id . ' should have been deleted, but has not.' .
|
||||
' Find it in the table called `transactions` and change the `deleted_at` field to: "' . $entry->journal_deleted . '"'
|
||||
' Find it in the table called "transactions" and change the "deleted_at" field to: "' . $entry->journal_deleted . '"'
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -242,7 +242,7 @@ class VerifyDatabase extends Command
|
||||
|
||||
foreach ($set as $entry) {
|
||||
$this->error(
|
||||
'Error: Journal #' . $entry->id . ' has zero transactions. Open table `transaction_journals` and delete the entry with id #' . $entry->id
|
||||
'Error: Journal #' . $entry->id . ' has zero transactions. Open table "transaction_journals" and delete the entry with id #' . $entry->id
|
||||
);
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ class VerifyDatabase extends Command
|
||||
foreach ($set as $entry) {
|
||||
$this->error(
|
||||
'Error: Transaction journal #' . $entry->journal_id . ' should have been deleted, but has not.' .
|
||||
' Find it in the table called `transaction_journals` and change the `deleted_at` field to: "' . $entry->transaction_deleted . '"'
|
||||
' Find it in the table called "transaction_journals" and change the "deleted_at" field to: "' . $entry->transaction_deleted . '"'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -139,6 +139,6 @@ class AccountReportHelper implements AccountReportHelperInterface
|
||||
->whereNull('transactions.deleted_at')
|
||||
->where('transaction_journals.date', '<=', $date->format('Y-m-d'))
|
||||
->groupBy('accounts.id')
|
||||
->get(['accounts.id', DB::raw('SUM(`transactions`.`amount`) as `balance`')]);
|
||||
->get(['accounts.id', DB::raw('SUM(transactions.amount) AS balance')]);
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
||||
->get(
|
||||
[
|
||||
't_destination.account_id',
|
||||
DB::raw('SUM(`t_destination`.`amount`) as `sum`'),
|
||||
DB::raw('SUM(t_destination.amount) AS sum'),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -106,7 +106,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
->get(
|
||||
[
|
||||
'bills.*',
|
||||
DB::raw('((`bills`.`amount_min` + `bills`.`amount_max`) / 2) as `expectedAmount`'),
|
||||
DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount'),
|
||||
]
|
||||
)->sortBy('name');
|
||||
|
||||
@ -141,7 +141,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
[
|
||||
'transaction_journals.bill_id',
|
||||
'transaction_journals.id',
|
||||
DB::raw('SUM(`transactions`.`amount`) as `journalAmount`'),
|
||||
DB::raw('SUM(transactions.amount) AS journalAmount'),
|
||||
]
|
||||
);
|
||||
|
||||
@ -247,7 +247,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
$join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '<', 0);
|
||||
}
|
||||
)
|
||||
->first([DB::raw('SUM(`transactions`.`amount`) as `sum_amount`')]);
|
||||
->first([DB::raw('SUM(transactions.amount) AS sum_amount')]);
|
||||
$sumAmount = $paid->sum_amount ?? '0';
|
||||
$amount = bcadd($amount, $sumAmount);
|
||||
}
|
||||
@ -282,7 +282,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
$join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '>', 0);
|
||||
}
|
||||
)
|
||||
->first([DB::raw('SUM(`transactions`.`amount`) as `sum_amount`')]);
|
||||
->first([DB::raw('SUM(transactions.amount) AS sum_amount')]);
|
||||
$sumAmount = $paid->sum_amount ?? '0';
|
||||
$paidBill = bcadd($sumAmount, $paidBill);
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
$transactions = new Collection;
|
||||
$fields = ['transactions.id', 'transactions.created_at', 'transactions.updated_at', 'transactions.deleted_at', 'transactions.account_id',
|
||||
'transactions.transaction_journal_id', 'transactions.description', 'transactions.amount',
|
||||
DB::raw('SUM(`transactions`.`amount`) as `sum`')];
|
||||
DB::raw('SUM(transactions.amount) AS sum')];
|
||||
$groupBy = ['transactions.id', 'transactions.created_at', 'transactions.updated_at', 'transactions.deleted_at', 'transactions.account_id',
|
||||
'transactions.transaction_journal_id', 'transactions.description', 'transactions.amount'];
|
||||
switch ($journal->transactionType->type) {
|
||||
|
@ -124,7 +124,7 @@ class Steam
|
||||
->where('transaction_journals.date', '>=', $start->format('Y-m-d'))
|
||||
->where('transaction_journals.date', '<=', $end->format('Y-m-d'))
|
||||
->groupBy('transaction_journals.date')
|
||||
->get(['transaction_journals.date', DB::raw('SUM(`transactions`.`amount`) as `modified`')]);
|
||||
->get(['transaction_journals.date', DB::raw('SUM(transactions.amount) AS modified')]);
|
||||
$currentBalance = $startBalance;
|
||||
foreach ($set as $entry) {
|
||||
$modified = is_null($entry->modified) ? '0' : strval($entry->modified);
|
||||
@ -164,7 +164,7 @@ class Steam
|
||||
->where('transaction_journals.date', '<=', $date->format('Y-m-d'))
|
||||
->groupBy('transactions.account_id')
|
||||
->whereIn('transactions.account_id', $ids)
|
||||
->get(['transactions.account_id', DB::raw('sum(`transactions`.`amount`) as aggregate')]);
|
||||
->get(['transactions.account_id', DB::raw('sum(transactions.amount) AS aggregate')]);
|
||||
|
||||
$result = [];
|
||||
foreach ($balances as $entry) {
|
||||
@ -191,7 +191,7 @@ class Steam
|
||||
$set = auth()->user()->transactions()
|
||||
->whereIn('transactions.account_id', $accounts)
|
||||
->groupBy(['transactions.account_id', 'transaction_journals.user_id'])
|
||||
->get(['transactions.account_id', DB::raw('MAX(`transaction_journals`.`date`) as `max_date`')]);
|
||||
->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]);
|
||||
|
||||
foreach ($set as $entry) {
|
||||
$list[intval($entry->account_id)] = new Carbon($entry->max_date);
|
||||
|
Loading…
Reference in New Issue
Block a user