mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 17:33:45 +00:00
Some last-minute fixes.
This commit is contained in:
@@ -90,6 +90,7 @@ class VerifyDatabase extends Command
|
||||
$this->createAccessTokens();
|
||||
$this->fixDoubleAmounts();
|
||||
$this->fixBadMeta();
|
||||
$this->removeBills();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -255,6 +256,23 @@ class VerifyDatabase extends Command
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function removeBills(): void
|
||||
{
|
||||
/** @var TransactionType $withdrawal */
|
||||
$withdrawal = TransactionType::where('type', TransactionType::WITHDRAWAL)->first();
|
||||
$journals = TransactionJournal::whereNotNull('bill_id')
|
||||
->where('transaction_type_id', '!=', $withdrawal->id)->get();
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$this->line(sprintf('Transaction journal #%d should not be linked to bill #%d.', $journal->id, $journal->bill_id));
|
||||
$journal->bill_id = null;
|
||||
$journal->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Eeport (and fix) piggy banks. Make sure there are only transfers linked to piggy bank events.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user