mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Null pointer in verify routine.
This commit is contained in:
parent
5d9e547d05
commit
d1c8e54798
@ -164,13 +164,16 @@ class VerifyDatabase extends Command
|
||||
}
|
||||
foreach ($errored as $journalId) {
|
||||
// select and update:
|
||||
$res = Transaction::where('transaction_journal_id', $journalId)->groupBy('amount')->get([DB::raw('MIN(id) as first_id')]);
|
||||
$res = Transaction::whereNull('deleted_at')->where('transaction_journal_id', $journalId)->groupBy('amount')->get([DB::raw('MIN(id) as first_id')]);
|
||||
$ids = $res->pluck('first_id')->toArray();
|
||||
DB::table('transactions')->whereIn('id', $ids)->update(['amount' => DB::raw('amount * -1')]);
|
||||
$count++;
|
||||
// report about it
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = TransactionJournal::find($journalId);
|
||||
if (is_null($journal)) {
|
||||
continue;
|
||||
}
|
||||
if ($journal->transactionType->type === TransactionType::OPENING_BALANCE) {
|
||||
$this->error(
|
||||
sprintf(
|
||||
|
Loading…
Reference in New Issue
Block a user