mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Clean up various code.
This commit is contained in:
@@ -47,64 +47,7 @@ class FixPostgresSequences extends Command
|
||||
return 0;
|
||||
}
|
||||
$this->friendlyLine('Going to verify PostgreSQL table sequences.');
|
||||
$tablesToCheck = [
|
||||
'2fa_tokens',
|
||||
'account_meta',
|
||||
'account_types',
|
||||
'accounts',
|
||||
'attachments',
|
||||
'auto_budgets',
|
||||
'available_budgets',
|
||||
'bills',
|
||||
'budget_limits',
|
||||
'budget_transaction',
|
||||
'budget_transaction_journal',
|
||||
'budgets',
|
||||
'categories',
|
||||
'category_transaction',
|
||||
'category_transaction_journal',
|
||||
'configuration',
|
||||
'currency_exchange_rates',
|
||||
'failed_jobs',
|
||||
'group_journals',
|
||||
'jobs',
|
||||
'journal_links',
|
||||
'journal_meta',
|
||||
'limit_repetitions',
|
||||
'link_types',
|
||||
'locations',
|
||||
'migrations',
|
||||
'notes',
|
||||
'oauth_clients',
|
||||
'oauth_personal_access_clients',
|
||||
'object_groups',
|
||||
'permissions',
|
||||
'piggy_bank_events',
|
||||
'piggy_bank_repetitions',
|
||||
'piggy_banks',
|
||||
'preferences',
|
||||
'recurrences',
|
||||
'recurrences_meta',
|
||||
'recurrences_repetitions',
|
||||
'recurrences_transactions',
|
||||
'roles',
|
||||
'rt_meta',
|
||||
'rule_actions',
|
||||
'rule_groups',
|
||||
'rule_triggers',
|
||||
'rules',
|
||||
'tag_transaction_journal',
|
||||
'tags',
|
||||
'transaction_currencies',
|
||||
'transaction_groups',
|
||||
'transaction_journals',
|
||||
'transaction_types',
|
||||
'transactions',
|
||||
'users',
|
||||
'webhook_attempts',
|
||||
'webhook_messages',
|
||||
'webhooks',
|
||||
];
|
||||
$tablesToCheck = ['2fa_tokens', 'account_meta', 'account_types', 'accounts', 'attachments', 'auto_budgets', 'available_budgets', 'bills', 'budget_limits', 'budget_transaction', 'budget_transaction_journal', 'budgets', 'categories', 'category_transaction', 'category_transaction_journal', 'configuration', 'currency_exchange_rates', 'failed_jobs', 'group_journals', 'jobs', 'journal_links', 'journal_meta', 'limit_repetitions', 'link_types', 'locations', 'migrations', 'notes', 'oauth_clients', 'oauth_personal_access_clients', 'object_groups', 'permissions', 'piggy_bank_events', 'piggy_bank_repetitions', 'piggy_banks', 'preferences', 'recurrences', 'recurrences_meta', 'recurrences_repetitions', 'recurrences_transactions', 'roles', 'rt_meta', 'rule_actions', 'rule_groups', 'rule_triggers', 'rules', 'tag_transaction_journal', 'tags', 'transaction_currencies', 'transaction_groups', 'transaction_journals', 'transaction_types', 'transactions', 'users', 'webhook_attempts', 'webhook_messages', 'webhooks'];
|
||||
|
||||
foreach ($tablesToCheck as $tableToCheck) {
|
||||
$this->friendlyLine(sprintf('Checking the next id sequence for table "%s".', $tableToCheck));
|
||||
|
@@ -104,7 +104,7 @@ class MigrateToGroups extends Command
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
if (null !== $configVar) {
|
||||
return (bool)$configVar->data;
|
||||
return (bool) $configVar->data;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -197,7 +197,7 @@ class MigrateToGroups extends Command
|
||||
{
|
||||
$set = $journal->transactions->filter(
|
||||
static function (Transaction $subject) use ($transaction) {
|
||||
$amount = (float)$transaction->amount * -1 === (float)$subject->amount; // intentional float
|
||||
$amount = (float) $transaction->amount * -1 === (float) $subject->amount; // intentional float
|
||||
$identifier = $transaction->identifier === $subject->identifier;
|
||||
app('log')->debug(sprintf('Amount the same? %s', var_export($amount, true)));
|
||||
app('log')->debug(sprintf('ID the same? %s', var_export($identifier, true)));
|
||||
@@ -209,6 +209,9 @@ class MigrateToGroups extends Command
|
||||
return $set->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*/
|
||||
private function generateTransaction(TransactionJournal $journal, Transaction $transaction): array
|
||||
{
|
||||
app('log')->debug(sprintf('Now going to add transaction #%d to the array.', $transaction->id));
|
||||
@@ -226,31 +229,31 @@ class MigrateToGroups extends Command
|
||||
return [];
|
||||
}
|
||||
|
||||
$budgetId = $this->cliRepository->getJournalBudgetId($journal);
|
||||
$categoryId = $this->cliRepository->getJournalCategoryId($journal);
|
||||
$notes = $this->cliRepository->getNoteText($journal);
|
||||
$tags = $this->cliRepository->getTags($journal);
|
||||
$internalRef = $this->cliRepository->getMetaField($journal, 'internal-reference');
|
||||
$sepaCC = $this->cliRepository->getMetaField($journal, 'sepa_cc');
|
||||
$sepaCtOp = $this->cliRepository->getMetaField($journal, 'sepa_ct_op');
|
||||
$sepaCtId = $this->cliRepository->getMetaField($journal, 'sepa_ct_id');
|
||||
$sepaDb = $this->cliRepository->getMetaField($journal, 'sepa_db');
|
||||
$sepaCountry = $this->cliRepository->getMetaField($journal, 'sepa_country');
|
||||
$sepaEp = $this->cliRepository->getMetaField($journal, 'sepa_ep');
|
||||
$sepaCi = $this->cliRepository->getMetaField($journal, 'sepa_ci');
|
||||
$sepaBatchId = $this->cliRepository->getMetaField($journal, 'sepa_batch_id');
|
||||
$externalId = $this->cliRepository->getMetaField($journal, 'external-id');
|
||||
$originalSource = $this->cliRepository->getMetaField($journal, 'original-source');
|
||||
$recurrenceId = $this->cliRepository->getMetaField($journal, 'recurrence_id');
|
||||
$bunq = $this->cliRepository->getMetaField($journal, 'bunq_payment_id');
|
||||
$hash = $this->cliRepository->getMetaField($journal, 'import_hash');
|
||||
$hashTwo = $this->cliRepository->getMetaField($journal, 'import_hash_v2');
|
||||
$interestDate = $this->cliRepository->getMetaDate($journal, 'interest_date');
|
||||
$bookDate = $this->cliRepository->getMetaDate($journal, 'book_date');
|
||||
$processDate = $this->cliRepository->getMetaDate($journal, 'process_date');
|
||||
$dueDate = $this->cliRepository->getMetaDate($journal, 'due_date');
|
||||
$paymentDate = $this->cliRepository->getMetaDate($journal, 'payment_date');
|
||||
$invoiceDate = $this->cliRepository->getMetaDate($journal, 'invoice_date');
|
||||
$budgetId = $this->cliRepository->getJournalBudgetId($journal);
|
||||
$categoryId = $this->cliRepository->getJournalCategoryId($journal);
|
||||
$notes = $this->cliRepository->getNoteText($journal);
|
||||
$tags = $this->cliRepository->getTags($journal);
|
||||
$internalRef = $this->cliRepository->getMetaField($journal, 'internal-reference');
|
||||
$sepaCC = $this->cliRepository->getMetaField($journal, 'sepa_cc');
|
||||
$sepaCtOp = $this->cliRepository->getMetaField($journal, 'sepa_ct_op');
|
||||
$sepaCtId = $this->cliRepository->getMetaField($journal, 'sepa_ct_id');
|
||||
$sepaDb = $this->cliRepository->getMetaField($journal, 'sepa_db');
|
||||
$sepaCountry = $this->cliRepository->getMetaField($journal, 'sepa_country');
|
||||
$sepaEp = $this->cliRepository->getMetaField($journal, 'sepa_ep');
|
||||
$sepaCi = $this->cliRepository->getMetaField($journal, 'sepa_ci');
|
||||
$sepaBatchId = $this->cliRepository->getMetaField($journal, 'sepa_batch_id');
|
||||
$externalId = $this->cliRepository->getMetaField($journal, 'external-id');
|
||||
$originalSource = $this->cliRepository->getMetaField($journal, 'original-source');
|
||||
$recurrenceId = $this->cliRepository->getMetaField($journal, 'recurrence_id');
|
||||
$bunq = $this->cliRepository->getMetaField($journal, 'bunq_payment_id');
|
||||
$hash = $this->cliRepository->getMetaField($journal, 'import_hash');
|
||||
$hashTwo = $this->cliRepository->getMetaField($journal, 'import_hash_v2');
|
||||
$interestDate = $this->cliRepository->getMetaDate($journal, 'interest_date');
|
||||
$bookDate = $this->cliRepository->getMetaDate($journal, 'book_date');
|
||||
$processDate = $this->cliRepository->getMetaDate($journal, 'process_date');
|
||||
$dueDate = $this->cliRepository->getMetaDate($journal, 'due_date');
|
||||
$paymentDate = $this->cliRepository->getMetaDate($journal, 'payment_date');
|
||||
$invoiceDate = $this->cliRepository->getMetaDate($journal, 'invoice_date');
|
||||
|
||||
// overrule journal category with transaction category.
|
||||
$budgetId = $this->getTransactionBudget($transaction, $opposingTr) ?? $budgetId;
|
||||
|
Reference in New Issue
Block a user