Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Clean up code.
James Coleab4bcd370353
diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.phpindex c6d409e70c..113c644b69 100644--- a/app/Http/Controllers/Report/CategoryController.php+++ b/app/Http/Controllers/Report/CategoryController.php@@ -284,7 +284,6 @@ class CategoryController extends Controller$spent = $this->opsRepository->listExpenses($start, $end, $accounts, $categories);$result = [];foreach ($spent as $currency) {- $currencyId = $currency['currency_id'];foreach ($currency['categories'] as $category) {foreach ($category['transaction_journals'] as $journal) {$destinationId = $journal['destination_account_id'];@@ -337,7 +336,6 @@ class CategoryController extends Controller$spent = $this->opsRepository->listIncome($start, $end, $accounts, $categories);$result = [];foreach ($spent as $currency) {- $currencyId = $currency['currency_id'];foreach ($currency['categories'] as $category) {foreach ($category['transaction_journals'] as $journal) {$sourceId = $journal['source_account_id'];@@ -536,7 +534,7 @@ class CategoryController extends Controller'entries' => [],];- foreach ($categoryRow['transaction_journals'] as $journalId => $journal) {+ foreach ($categoryRow['transaction_journals'] as $journal) {$date = $journal['date']->format($format);$data[$key]['entries'][$date] = $data[$key]['entries'][$date] ?? '0';$data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date], $journal['amount']);@@ -616,7 +614,7 @@ class CategoryController extends Controller'entries' => [],];- foreach ($categoryRow['transaction_journals'] as $journalId => $journal) {+ foreach ($categoryRow['transaction_journals'] as $journal) {$date = $journal['date']->format($format);$data[$key]['entries'][$date] = $data[$key]['entries'][$date] ?? '0';$data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date], $journal['amount']);@@ -662,7 +660,7 @@ class CategoryController extends Controller$cache->addProperty('category-report');$cache->addProperty($accounts->pluck('id')->toArray());if ($cache->has()) {- //return $cache->get(); // @codeCoverageIgnore+ return $cache->get(); // @codeCoverageIgnore}/** @var CategoryReportGenerator $generator */@@ -700,7 +698,6 @@ class CategoryController extends Controller$spent = $this->opsRepository->listExpenses($start, $end, $accounts, $categories);$result = [];foreach ($spent as $currency) {- $currencyId = $currency['currency_id'];foreach ($currency['categories'] as $category) {foreach ($category['transaction_journals'] as $journal) {$result[] = [@@ -750,7 +747,6 @@ class CategoryController extends Controller$spent = $this->opsRepository->listIncome($start, $end, $accounts, $categories);$result = [];foreach ($spent as $currency) {- $currencyId = $currency['currency_id'];foreach ($currency['categories'] as $category) {foreach ($category['transaction_journals'] as $journal) {$result[] = [@@ -787,17 +783,4 @@ class CategoryController extends Controllerreturn $result;}- /**- * @param array $array- *- * @return bool- */- private function noAmountInArray(array $array): bool- {- if (0 === count($array)) {- return true;- }-- return false;- }}diff --git a/app/Jobs/CreateRecurringTransactions.php b/app/Jobs/CreateRecurringTransactions.phpindex f7d8dbe1fc..252ee95b7f 100644--- a/app/Jobs/CreateRecurringTransactions.php+++ b/app/Jobs/CreateRecurringTransactions.php@@ -168,23 +168,6 @@ class CreateRecurringTransactions implements ShouldQueuereturn $recurrence->active;}- /**- * Helper function for debug information.- *- * @param array $occurrences- *- * @return array- */- private function debugArray(array $occurrences): array- {- $return = [];- foreach ($occurrences as $entry) {- $return[] = $entry->format('Y-m-d');- }-- return $return;- }-/*** @param Collection $recurrences*@@ -427,23 +410,6 @@ class CreateRecurringTransactions implements ShouldQueuereturn $startDate->gt($this->date);}- /***- * @param Recurrence $recurrence- * @param TransactionGroup $group- */- private function linkGroupToPiggies(Recurrence $recurrence, TransactionGroup $group): void- {- /** @var TransactionJournal $journal */- foreach ($group->transactionJournals as $journal) {- // get piggy bank ID from meta data:- $piggyBank = $this->repository->getPiggyBank($recurrence);- if (null !== $piggyBank) {- /** @var PiggyBankEventFactory $factory */- $factory = app(PiggyBankEventFactory::class);- $factory->create($journal, $piggyBank);- }- }- }/*** Return true if the $repeat_until date is in the past.diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.phpindex 343f833267..b8f66ebbcb 100644--- a/app/Repositories/Tag/TagRepository.php+++ b/app/Repositories/Tag/TagRepository.php@@ -582,46 +582,4 @@ class TagRepository implements TagRepositoryInterface});}-- /**- * @param string $oldName- * @param string $newName- */- private function updateRuleActions(string $oldName, string $newName): void- {- $types = ['add_tag', 'remove_tag'];- $actions = RuleAction::leftJoin('rules', 'rules.id', '=', 'rule_actions.rule_id')- ->where('rules.user_id', $this->user->id)- ->whereIn('rule_actions.action_type', $types)- ->where('rule_actions.action_value', $oldName)- ->get(['rule_actions.*']);- Log::debug(sprintf('Found %d actions to update.', $actions->count()));- /** @var RuleAction $action */- foreach ($actions as $action) {- $action->action_value = $newName;- $action->save();- Log::debug(sprintf('Updated action %d: %s', $action->id, $action->action_value));- }- }-- /**- * @param string $oldName- * @param string $newName- */- private function updateRuleTriggers(string $oldName, string $newName): void- {- $types = ['tag_is',];- $triggers = RuleTrigger::leftJoin('rules', 'rules.id', '=', 'rule_triggers.rule_id')- ->where('rules.user_id', $this->user->id)- ->whereIn('rule_triggers.trigger_type', $types)- ->where('rule_triggers.trigger_value', $oldName)- ->get(['rule_triggers.*']);- Log::debug(sprintf('Found %d triggers to update.', $triggers->count()));- /** @var RuleTrigger $trigger */- foreach ($triggers as $trigger) {- $trigger->trigger_value = $newName;- $trigger->save();- Log::debug(sprintf('Updated trigger %d: %s', $trigger->id, $trigger->trigger_value));- }- }}diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.phpindex 446217f028..a3b3fcf5d2 100644--- a/app/Support/Search/OperatorQuerySearch.php+++ b/app/Support/Search/OperatorQuerySearch.php@@ -81,6 +81,7 @@ class OperatorQuerySearch implements SearchInterface/*** OperatorQuerySearch constructor.+ ** @codeCoverageIgnore*/public function __construct()@@ -194,6 +195,7 @@ class OperatorQuerySearch implements SearchInterfaceif (0 === count($this->getWords()) && 0 === count($this->getOperators())) {return new LengthAwarePaginator;}+return $this->collector->getPaginatedGroups();}@@ -212,12 +214,13 @@ class OperatorQuerySearch implements SearchInterface$this->collector->setUser($this->user);$this->collector->withAccountInformation()->withCategoryInformation()->withBudgetInformation();- $this->setLimit((int) app('preferences')->getForUser($user, 'listPageSize', 50)->data);+ $this->setLimit((int)app('preferences')->getForUser($user, 'listPageSize', 50)->data);}/*** @param Node $searchNode+ ** @throws FireflyException*/private function handleSearchNode(Node $searchNode): void@@ -237,7 +240,7 @@ class OperatorQuerySearch implements SearchInterfacecase Emoji::class:case Mention::class:Log::debug(sprintf('Now handle %s', $class));- $this->words[] = (string) $searchNode->getValue();+ $this->words[] = (string)$searchNode->getValue();break;case Field::class:Log::debug(sprintf('Now handle %s', $class));@@ -246,15 +249,13 @@ class OperatorQuerySearch implements SearchInterface$operator = strtolower($searchNode->getValue());$value = $searchNode->getNode()->getValue();// must be valid operator:- if (in_array($operator, $this->validOperators, true)) {- if ($this->updateCollector($operator, (string) $value)) {- $this->operators->push(- [- 'type' => self::getRootOperator($operator),- 'value' => (string) $value,- ]- );- }+ if (in_array($operator, $this->validOperators, true) && $this->updateCollector($operator, (string)$value)) {+ $this->operators->push(+ [+ 'type' => self::getRootOperator($operator),+ 'value' => (string)$value,+ ]+ );}break;}@@ -264,6 +265,7 @@ class OperatorQuerySearch implements SearchInterface/*** @param string $operator* @param string $value+ ** @return bool* @throws FireflyException*/@@ -283,6 +285,7 @@ class OperatorQuerySearch implements SearchInterface// some search operators are ignored, basically:case 'user_action':Log::info(sprintf('Ignore search operator "%s"', $operator));+return false;//// all account related searches:@@ -312,7 +315,7 @@ class OperatorQuerySearch implements SearchInterface$this->searchAccount($value, 1, 3);break;case 'source_account_id':- $account = $this->accountRepository->findNull((int) $value);+ $account = $this->accountRepository->findNull((int)$value);if (null !== $account) {$this->collector->setSourceAccounts(new Collection([$account]));}@@ -346,7 +349,7 @@ class OperatorQuerySearch implements SearchInterface$this->searchAccount($value, 2, 3);break;case 'destination_account_id':- $account = $this->accountRepository->findNull((int) $value);+ $account = $this->accountRepository->findNull((int)$value);if (null !== $account) {$this->collector->setDestinationAccounts(new Collection([$account]));}@@ -355,7 +358,7 @@ class OperatorQuerySearch implements SearchInterface$parts = explode(',', $value);$collection = new Collection;foreach ($parts as $accountId) {- $account = $this->accountRepository->findNull((int) $accountId);+ $account = $this->accountRepository->findNull((int)$accountId);if (null !== $account) {$collection->push($account);}@@ -390,6 +393,7 @@ class OperatorQuerySearch implements SearchInterfacebreak;case 'description_contains':$this->words[] = $value;+return false;case 'description_is':$this->collector->descriptionIs($value);@@ -494,17 +498,17 @@ class OperatorQuerySearch implements SearchInterface// amount//case 'amount_exactly':- $amount = app('steam')->positive((string) $value);+ $amount = app('steam')->positive((string)$value);Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));$this->collector->amountIs($amount);break;case 'amount_less':- $amount = app('steam')->positive((string) $value);+ $amount = app('steam')->positive((string)$value);Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));$this->collector->amountLess($amount);break;case 'amount_more':- $amount = app('steam')->positive((string) $value);+ $amount = app('steam')->positive((string)$value);Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));$this->collector->amountMore($amount);break;@@ -520,7 +524,12 @@ class OperatorQuerySearch implements SearchInterface//case 'date_is':$range = $this->parseDateRange($value);- Log::debug(sprintf('Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'), $range['end']->format('Y-m-d')));+ Log::debug(+ sprintf(+ 'Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'),+ $range['end']->format('Y-m-d')+ )+ );$this->collector->setRange($range['start'], $range['end']);// add to operators manually:@@ -531,7 +540,12 @@ class OperatorQuerySearch implements SearchInterfacecase 'date_before':Log::debug(sprintf('Value for date_before is "%s"', $value));$range = $this->parseDateRange($value);- Log::debug(sprintf('Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'), $range['end']->format('Y-m-d')));+ Log::debug(+ sprintf(+ 'Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'),+ $range['end']->format('Y-m-d')+ )+ );// add to operators manually:$this->operators->push(['type' => 'date_before', 'value' => $range['start']->format('Y-m-d'),]);@@ -541,7 +555,12 @@ class OperatorQuerySearch implements SearchInterfacecase 'date_after':Log::debug(sprintf('Value for date_after is "%s"', $value));$range = $this->parseDateRange($value);- Log::debug(sprintf('Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'), $range['end']->format('Y-m-d')));+ Log::debug(+ sprintf(+ 'Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'),+ $range['end']->format('Y-m-d')+ )+ );// add to operators manually:$this->operators->push(['type' => 'date_after', 'value' => $range['end']->format('Y-m-d'),]);@@ -568,12 +587,14 @@ class OperatorQuerySearch implements SearchInterface$this->collector->setInternalReference($value);break;}+return true;}/*** searchDirection: 1 = source (default), 2 = destination* stringPosition: 1 = start (default), 2 = end, 3 = contains, 4 = is+ ** @param string $value* @param int $searchDirection* @param int $stringPosition@@ -617,15 +638,18 @@ class OperatorQuerySearch implements SearchInterfacereturn;}Log::debug(sprintf('Found %d accounts, will filter.', $accounts->count()));- $filtered = $accounts->filter(function (Account $account) use ($value, $stringMethod) {- return $stringMethod(strtolower($account->name), strtolower($value));- });+ $filtered = $accounts->filter(+ function (Account $account) use ($value, $stringMethod) {+ return $stringMethod(strtolower($account->name), strtolower($value));+ }+ );if (0 === $filtered->count()) {Log::debug('Left with zero accounts, search for invalid account.');$account = new Account;$account->id = 0;$this->collector->$collectorMethod(new Collection([$account]));+return;}Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));@@ -636,6 +660,7 @@ class OperatorQuerySearch implements SearchInterface/*** searchDirection: 1 = source (default), 2 = destination* stringPosition: 1 = start (default), 2 = end, 3 = contains, 4 = is+ ** @param string $value* @param int $searchDirection* @param int $stringPosition@@ -675,29 +700,34 @@ class OperatorQuerySearch implements SearchInterface$account = new Account;$account->id = 0;$this->collector->$collectorMethod(new Collection([$account]));+return;}// if found, do filterLog::debug(sprintf('Found %d accounts, will filter.', $accounts->count()));- $filtered = $accounts->filter(function (Account $account) use ($value, $stringMethod) {- // either IBAN or account number!- $ibanMatch = $stringMethod(strtolower((string) $account->iban), strtolower((string) $value));- $accountNrMatch = false;- /** @var AccountMeta $meta */- foreach ($account->accountMeta as $meta) {- if ('account_number' === $meta->name && $stringMethod(strtolower($meta->data), strtolower($value))) {- $accountNrMatch = true;+ $filtered = $accounts->filter(+ function (Account $account) use ($value, $stringMethod) {+ // either IBAN or account number!+ $ibanMatch = $stringMethod(strtolower((string)$account->iban), strtolower((string)$value));+ $accountNrMatch = false;+ /** @var AccountMeta $meta */+ foreach ($account->accountMeta as $meta) {+ if ('account_number' === $meta->name && $stringMethod(strtolower($meta->data), strtolower($value))) {+ $accountNrMatch = true;+ }}++ return $ibanMatch || $accountNrMatch;}- return $ibanMatch || $accountNrMatch;- });+ );if (0 === $filtered->count()) {Log::debug('Left with zero, search for invalid account');$account = new Account;$account->id = 0;$this->collector->$collectorMethod(new Collection([$account]));+return;}Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));@@ -706,6 +736,7 @@ class OperatorQuerySearch implements SearchInterface/*** @param string $value+ ** @return TransactionCurrency|null*/private function findCurrency(string $value): ?TransactionCurrency@@ -721,11 +752,13 @@ class OperatorQuerySearch implements SearchInterfaceif (null === $result) {$result = $this->currencyRepository->findByNameNull($value);}+return $result;}/*** @param string $operator+ ** @return string* @throws FireflyException*/@@ -737,6 +770,7 @@ class OperatorQuerySearch implements SearchInterface}if (true === $config['alias']) {Log::debug(sprintf('"%s" is an alias for "%s", so return that instead.', $operator, $config['alias_for']));+return $config['alias_for'];}Log::debug(sprintf('"%s" is not an alias.', $operator));@@ -746,6 +780,7 @@ class OperatorQuerySearch implements SearchInterface/*** @param string $value+ ** @return array* @throws FireflyException*/@@ -756,6 +791,7 @@ class OperatorQuerySearch implements SearchInterfacereturn $parser->parseRange($value, today(config('app.timezone')));}$date = $parser->parseDate($value);+return ['start' => $date,'end' => $date,diff --git a/app/Support/Steam.php b/app/Support/Steam.phpindex 075994615c..39e66aa551 100644--- a/app/Support/Steam.php+++ b/app/Support/Steam.php@@ -49,9 +49,6 @@ class Steam*/public function balance(Account $account, Carbon $date, ?TransactionCurrency $currency = null): string{- if ('testing' === config('app.env')) {- Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));- }// abuse chart properties:$cache = new CacheProperties;$cache->addProperty($account->id);@@ -105,9 +102,6 @@ class Steam*/public function balanceIgnoreVirtual(Account $account, Carbon $date): string{- if ('testing' === config('app.env')) {- Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));- }// abuse chart properties:$cache = new CacheProperties;$cache->addProperty($account->id);@@ -177,9 +171,6 @@ class Steam*/public function balanceInRange(Account $account, Carbon $start, Carbon $end, ?TransactionCurrency $currency = null): array{- if ('testing' === config('app.env')) {- Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));- }// abuse chart properties:$cache = new CacheProperties;$cache->addProperty($account->id);@@ -264,9 +255,6 @@ class Steam*/public function balancePerCurrency(Account $account, Carbon $date): array{- if ('testing' === config('app.env')) {- Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));- }// abuse chart properties:$cache = new CacheProperties;$cache->addProperty($account->id);@@ -300,9 +288,6 @@ class Steam*/public function balancesByAccounts(Collection $accounts, Carbon $date): array{- if ('testing' === config('app.env')) {- Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));- }$ids = $accounts->pluck('id')->toArray();// cache this property.$cache = new CacheProperties;@@ -335,9 +320,6 @@ class Steam*/public function balancesPerCurrencyByAccounts(Collection $accounts, Carbon $date): array{- if ('testing' === config('app.env')) {- Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));- }$ids = $accounts->pluck('id')->toArray();// cache this property.$cache = new CacheProperties;@@ -497,9 +479,6 @@ class Steam*/public function getLastActivities(array $accounts): array{- if ('testing' === config('app.env')) {- Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));- }$list = [];$set = auth()->user()->transactions()diff --git a/app/Support/Twig/Rule.php b/app/Support/Twig/Rule.phpindex ac5769a049..b09f891e61 100644--- a/app/Support/Twig/Rule.php+++ b/app/Support/Twig/Rule.php@@ -77,7 +77,7 @@ class Rule extends AbstractExtensionreturn new TwigFunction('allRuleTriggers',static function () {- $ruleTriggers = array_keys(config('firefly.search.operators'));;+ $ruleTriggers = array_keys(config('firefly.search.operators'));$possibleTriggers = [];foreach ($ruleTriggers as $key) {if ('user_action' !== $key) {diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.phpindex f272b0945f..e6adb2ba34 100644--- a/app/Validation/FireflyValidator.php+++ b/app/Validation/FireflyValidator.php@@ -362,7 +362,7 @@ class FireflyValidator extends Validator}// and finally a "will match everything check":- $classes = array_keys(config('firefly.search.operators'));;+ $classes = array_keys(config('firefly.search.operators'));/** @var TriggerInterface $class */$class = $classes[$triggerType] ?? false;if (false === $class) {diff --git a/config/firefly.php b/config/firefly.phpindex 41b46001ca..e27c3133ec 100644--- a/config/firefly.php+++ b/config/firefly.php@@ -225,57 +225,57 @@ return ['liability' => 'Liabilities',],'subIconsByIdentifier' => [- 'asset' => 'fa-money',- 'Asset account' => 'fa-money',- 'Default account' => 'fa-money',- 'Cash account' => 'fa-money',- 'expense' => 'fa-shopping-cart',- 'Expense account' => 'fa-shopping-cart',- 'Beneficiary account' => 'fa-shopping-cart',- 'revenue' => 'fa-download',- 'Revenue account' => 'fa-download',- 'import' => 'fa-download',- 'Import account' => 'fa-download',- 'liabilities' => 'fa-ticket',+ 'asset' => 'fa-money',+ AccountType::ASSET => 'fa-money',+ AccountType::DEFAULT => 'fa-money',+ AccountType::CASH => 'fa-money',+ 'expense' => 'fa-shopping-cart',+ AccountType::EXPENSE => 'fa-shopping-cart',+ AccountType::BENEFICIARY => 'fa-shopping-cart',+ 'revenue' => 'fa-download',+ AccountType::REVENUE => 'fa-download',+ 'import' => 'fa-download',+ AccountType::IMPORT => 'fa-download',+ 'liabilities' => 'fa-ticket',],'accountTypesByIdentifier' => [- 'asset' => ['Default account', 'Asset account'],- 'expense' => ['Expense account', 'Beneficiary account'],- 'revenue' => ['Revenue account'],- 'import' => ['Import account'],- 'liabilities' => ['Loan', 'Debt', 'Credit card', 'Mortgage'],+ 'asset' => [AccountType::DEFAULT, AccountType::ASSET],+ 'expense' => [AccountType::EXPENSE, AccountType::BENEFICIARY],+ 'revenue' => [AccountType::REVENUE],+ 'import' => [AccountType::IMPORT],+ 'liabilities' => [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE],],'accountTypeByIdentifier' => [- 'asset' => ['Asset account'],- 'expense' => ['Expense account'],- 'revenue' => ['Revenue account'],- 'opening' => ['Initial balance account'],- 'initial' => ['Initial balance account'],- 'import' => ['Import account'],- 'reconcile' => ['Reconciliation account'],- 'liabilities' => ['Loan', 'Debt', 'Mortgage', 'Credit card'],- 'liability' => ['Loan', 'Debt', 'Mortgage', 'Credit card'],+ 'asset' => [AccountType::ASSET],+ 'expense' => [AccountType::EXPENSE],+ 'revenue' => [AccountType::REVENUE],+ 'opening' => [AccountType::INITIAL_BALANCE],+ 'initial' => [AccountType::INITIAL_BALANCE],+ 'import' => [AccountType::IMPORT],+ 'reconcile' => [AccountType::RECONCILIATION],+ 'liabilities' => [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::CREDITCARD],+ 'liability' => [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::CREDITCARD],],'shortNamesByFullName' => [- 'Default account' => 'asset',- 'Asset account' => 'asset',- 'Import account' => 'import',- 'Expense account' => 'expense',- 'Beneficiary account' => 'expense',- 'Revenue account' => 'revenue',- 'Cash account' => 'cash',- 'Initial balance account' => 'initial-balance',- 'Reconciliation account' => 'reconciliation',- 'Credit card' => 'liabilities',- 'Loan' => 'liabilities',- 'Debt' => 'liabilities',- 'Mortgage' => 'liabilities',+ AccountType::DEFAULT => 'asset',+ AccountType::ASSET => 'asset',+ AccountType::IMPORT => 'import',+ AccountType::EXPENSE => 'expense',+ AccountType::BENEFICIARY => 'expense',+ AccountType::REVENUE => 'revenue',+ AccountType::CASH => 'cash',+ AccountType::INITIAL_BALANCE => 'initial-balance',+ AccountType::RECONCILIATION => 'reconciliation',+ AccountType::CREDITCARD => 'liabilities',+ AccountType::LOAN => 'liabilities',+ AccountType::DEBT => 'liabilities',+ AccountType::MORTGAGE => 'liabilities',],'shortLiabilityNameByFullName' => [- 'Credit card' => 'creditcard',- 'Loan' => 'loan',- 'Debt' => 'debt',- 'Mortgage' => 'mortgage',+ AccountType::CREDITCARD => 'creditcard',+ AccountType::LOAN => AccountType::LOAN,+ AccountType::DEBT => AccountType::DEBT,+ AccountType::MORTGAGE => AccountType::MORTGAGE,],/*** Languages configuration.@@ -576,7 +576,7 @@ return ['to_account_nr_ends' => ['alias' => true, 'alias_for' => 'destination_account_nr_ends', 'needs_context' => true,],// any account id is- 'account_id' => ['alias' => false, 'needs_context' => true,], // TODO+ 'account_id' => ['alias' => false, 'needs_context' => true,],// category'category_is' => ['alias' => false, 'needs_context' => true,],@@ -587,7 +587,7 @@ return ['budget' => ['alias' => true, 'alias_for' => 'budget_is', 'needs_context' => true,],// bill- 'bill_is' => ['alias' => false, 'needs_context' => true,], // TODO+ 'bill_is' => ['alias' => false, 'needs_context' => true,],'bill' => ['alias' => true, 'alias_for' => 'bill_is', 'needs_context' => true,],// type@@ -692,8 +692,8 @@ return [TransactionTypeModel::OPENING_BALANCE,],AccountType::MORTGAGE => [TransactionTypeModel::WITHDRAWAL, TransactionTypeModel::DEPOSIT, TransactionTypeModel::TRANSFER,TransactionTypeModel::OPENING_BALANCE,],- AccountType::INITIAL_BALANCE => [], // todo fill me in.- AccountType::RECONCILIATION => [], // todo fill me in.+ AccountType::INITIAL_BALANCE => [TransactionTypeModel::OPENING_BALANCE],+ AccountType::RECONCILIATION => [TransactionTypeModel::RECONCILIATION],],'destination' => [AccountType::ASSET => [TransactionTypeModel::DEPOSIT, TransactionTypeModel::TRANSFER, TransactionTypeModel::OPENING_BALANCE,@@ -706,8 +706,8 @@ return [TransactionTypeModel::OPENING_BALANCE,],AccountType::MORTGAGE => [TransactionTypeModel::WITHDRAWAL, TransactionTypeModel::DEPOSIT, TransactionTypeModel::TRANSFER,TransactionTypeModel::OPENING_BALANCE,],- AccountType::INITIAL_BALANCE => [], // todo fill me in.- AccountType::RECONCILIATION => [], // todo fill me in.+ AccountType::INITIAL_BALANCE => [TransactionTypeModel::OPENING_BALANCE],+ AccountType::RECONCILIATION => [TransactionTypeModel::RECONCILIATION],],],diff --git a/frontend/src/components/accounts/List.vue b/frontend/src/components/accounts/List.vueindex 8801744044..421d311dc6 100644--- a/frontend/src/components/accounts/List.vue+++ b/frontend/src/components/accounts/List.vue@@ -35,18 +35,6 @@</div></div></div>- <!-- TODO -->- <!--- <div class="card-tools">- <ul class="pagination pagination-sm float-right">- <li class="page-item"><a class="page-link" href="#">«</a></li>- <li class="page-item"><a class="page-link" href="#">1</a></li>- <li class="page-item"><a class="page-link" href="#">2</a></li>- <li class="page-item"><a class="page-link" href="#">3</a></li>- <li class="page-item"><a class="page-link" href="#">»</a></li>- </ul>- </div>- --></div><div class="card-body p-0"><table class="table table-sm table-striped">diff --git a/frontend/src/pages/dashboard.js b/frontend/src/pages/dashboard.jsindex 2c7e84cdb3..45c1521f61 100644--- a/frontend/src/pages/dashboard.js+++ b/frontend/src/pages/dashboard.js@@ -31,7 +31,6 @@ import MainPiggyList from "../components/dashboard/MainPiggyList";import TransactionListLarge from "../components/transactions/TransactionListLarge";import TransactionListMedium from "../components/transactions/TransactionListMedium";import TransactionListSmall from "../components/transactions/TransactionListSmall";-import {Chart} from 'vue-chartjs'/*** First we will load Axios via bootstrap.jsdiff --git a/frontend/src/pages/register.js b/frontend/src/pages/register.jsindex c540676557..ab7d16e610 100644--- a/frontend/src/pages/register.js+++ b/frontend/src/pages/register.js@@ -18,9 +18,6 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.*/-import Dashboard from "../components/dashboard/Dashboard";-import TopBoxes from "../components/dashboard/TopBoxes";-/*** First we will load Axios via bootstrap.js* jquery and bootstrap-sass preloaded in app.jsdiff --git a/public/v1/css/firefly.css b/public/v1/css/firefly.cssindex 007a97f226..13d1eb13ec 100644--- a/public/v1/css/firefly.css+++ b/public/v1/css/firefly.css@@ -179,10 +179,6 @@ span.info-box-text a:hover, span.info-box-number a:hover {overflow-x: hidden;}-.bootstrap-tagsinput {- width: 100%;-}-.accordion {margin-bottom:-3px;}diff --git a/public/v1/js/ff/accounts/index.js b/public/v1/js/ff/accounts/index.jsindex 9f5e57d507..6b3a18f123 100644--- a/public/v1/js/ff/accounts/index.js+++ b/public/v1/js/ff/accounts/index.js@@ -63,7 +63,6 @@ function stopSorting() {"use strict";$.each($('#sortable-table>tbody>tr.sortable-object'), function (i, v) {var holder = $(v);- var parentBody = holder.parent();var position = parseInt(holder.data('position'));var originalOrder = parseInt(holder.data('order'));var id = holder.data('id');diff --git a/public/v1/js/ff/charts.js b/public/v1/js/ff/charts.jsindex 57a64314d1..996294241f 100644--- a/public/v1/js/ff/charts.js+++ b/public/v1/js/ff/charts.js@@ -45,12 +45,9 @@ var colourSet = [];var fillColors = [];-var strokePointHighColors = [];-for (var i = 0; i < colourSet.length; i++) {fillColors.push("rgba(" + colourSet[i][0] + ", " + colourSet[i][1] + ", " + colourSet[i][2] + ", 0.5)");- strokePointHighColors.push("rgba(" + colourSet[i][0] + ", " + colourSet[i][1] + ", " + colourSet[i][2] + ", 0.9)");}Chart.defaults.global.legend.display = false;diff --git a/public/v1/js/ff/index.js b/public/v1/js/ff/index.jsindex d6e6c5799a..60b42df9ae 100644--- a/public/v1/js/ff/index.js+++ b/public/v1/js/ff/index.js@@ -108,7 +108,6 @@ function getBillsBox() {var unpaid = [];var paid = [];for (key in data) {- var row = data[key];//console.log(key);if (key.substr(0, 16) === 'bills-unpaid-in-') {// only when less than 3.diff --git a/public/v1/js/ff/reports/index.js b/public/v1/js/ff/reports/index.jsindex c11124a6b5..d6e6ef1b5f 100644--- a/public/v1/js/ff/reports/index.js+++ b/public/v1/js/ff/reports/index.js@@ -51,7 +51,7 @@ $(function () {);// set report type from cookie, if any:- if (!(readCookie('report-type') === null)) {+ if (null !== readCookie('report-type')) {$('select[name="report_type"]').val(readCookie('report-type'));}diff --git a/public/v1/js/ff/rules/create-edit.js b/public/v1/js/ff/rules/create-edit.jsindex 033307577e..9ebf36bbad 100644--- a/public/v1/js/ff/rules/create-edit.js+++ b/public/v1/js/ff/rules/create-edit.js@@ -252,9 +252,6 @@ function updateActionInput(selectList) {createAutoComplete(inputResult, 'api/v1/autocomplete/transactions');break;case 'set_source_account':- console.log('Select list value is ' + selectList.val() + ', so input needs auto complete.');- createAutoComplete(inputResult, 'api/v1/autocomplete/accounts');- break;case 'set_destination_account':console.log('Select list value is ' + selectList.val() + ', so input needs auto complete.');createAutoComplete(inputResult, 'api/v1/autocomplete/accounts');diff --git a/resources/assets/js/components/passport/Clients.vue b/resources/assets/js/components/passport/Clients.vueindex c6147dec3a..edbfa9d982 100644--- a/resources/assets/js/components/passport/Clients.vue+++ b/resources/assets/js/components/passport/Clients.vue@@ -121,7 +121,7 @@</div><!-- Create Client Form -->- <form role="form">+ <form role="form" aria-label="form"><!-- Name --><div class="form-group row"><label class="col-md-3 col-form-label">{{ $t('firefly.name') }}</label>@@ -208,7 +208,7 @@</div><!-- Edit Client Form -->- <form role="form">+ <form role="form" aria-label="form"><!-- Name --><div class="form-group row"><label class="col-md-3 col-form-label">{{ $t('firefly.name') }}</label>diff --git a/resources/assets/js/components/transactions/CreateTransaction.vue b/resources/assets/js/components/transactions/CreateTransaction.vueindex 4da76dc64d..43918734c7 100644--- a/resources/assets/js/components/transactions/CreateTransaction.vue+++ b/resources/assets/js/components/transactions/CreateTransaction.vue@@ -842,19 +842,7 @@ export default {deleteTransaction: function (index, event) {event.preventDefault();- for (const key in this.transactions) {- if (- this.transactions.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {- }- }-this.transactions.splice(index, 1);-- for (const key in this.transactions) {- if (- this.transactions.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {- }- }},limitSourceType: function (type) {let i;diff --git a/resources/assets/js/components/transactions/EditTransaction.vue b/resources/assets/js/components/transactions/EditTransaction.vueindex 13c37c5fd1..8a4a28d03e 100644--- a/resources/assets/js/components/transactions/EditTransaction.vue+++ b/resources/assets/js/components/transactions/EditTransaction.vue@@ -585,7 +585,6 @@ export default {tagList = [];foreignAmount = '0';- foreignCurrency = null;// loop tagsfor (let tagKey in row.tags) {if (row.tags.hasOwnProperty(tagKey) && /^0$|^[1-9]\d*$/.test(tagKey) && tagKey <= 4294967294) {